count = 0
n = int(input())
l = list()
for i in range (n):
l.append(input())
for j in range (len(l)):
if type(l[j]) == str:
if l[j][0] == '(' and l[j][-1] == ')':
break
else:
count += 1
else:
count += 1
print (count)
Y291bnQgPSAwCm4gPSBpbnQoaW5wdXQoKSkKbCA9IGxpc3QoKQpmb3IgaSBpbiByYW5nZSAobik6CiAgIGwuYXBwZW5kKGlucHV0KCkpCmZvciBqIGluIHJhbmdlIChsZW4obCkpOgogICBpZiB0eXBlKGxbal0pID09IHN0cjoKICAgICAgaWYgbFtqXVswXSA9PSAnKCcgYW5kIGxbal1bLTFdID09ICcpJzoKICAgICAgICAgYnJlYWsKICAgICAgZWxzZToKICAgICAgICAgY291bnQgKz0gMQogICBlbHNlOgogICAgICBjb3VudCArPSAxCiAgICAgIApwcmludCAoY291bnQpCg==