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]) == list:
if l[j](0) == '(' and l[j](-1) == ')':
break
else:
count += 1
else:
count += 1
print (count)
Y291bnQgPSAwCm4gPSBpbnQoaW5wdXQoKSkKbCA9IGxpc3QoKQpmb3IgaSBpbiByYW5nZSAobik6CiAgIGwuYXBwZW5kKGlucHV0KCkpCmZvciBqIGluIHJhbmdlIChsZW4obCkpOgogICBpZiB0eXBlKGxbal0pID09IGxpc3Q6CiAgICAgIGlmIGxbal0oMCkgPT0gJygnIGFuZCBsW2pdKC0xKSA9PSAnKSc6CiAgICAgICAgIGJyZWFrCiAgICAgIGVsc2U6CiAgICAgICAgIGNvdW50ICs9IDEKICAgZWxzZToKICAgICAgY291bnQgKz0gMQogICAgICAKcHJpbnQgKGNvdW50KQo=