# coding: utf-8 # Your code here! from collections import Counter class Counters(): def __init__ (self, chars): self.x = chars def count_x (self, x, y): ans = [] for lst in self.x: count_num = 0 for chars in lst: if x == chars or y == chars: continue else: count_num = count_num + 1 ans.append(count_num) answer = Counter(ans).most_common() last_answer = None for taple in answer: if last_answer == None: last_answer = taple elif taple[1] == last_answer[1]: if taple[0] >= last_answer[0]: last_answer = taple else: continue else: break return last_answer[0] lst = [] for x in range(int(input())): lst.append(input()) test = Counters(lst) print(test.count_x('(', ')'))