N = int(input()) dic = {} for i in range(0, N): S = input() dic[len(S)] = dic.get(len(S), 0) + 1 max = 0 ans = 0 for x, y in dic.items(): if y > max or y == max and x > ans: max = y ans = x print(ans-2)