from collections import Counter as c d=c(map(len,[input() for _ in range(int(input()))])).items() print(sorted(d,key=lambda x:(-x[1],-x[0]))[0][0]-2)