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)
