from collections import Counter n=int(input()) s=[len(input())-2 for _ in range(n)] b,c=zip(*Counter(s).most_common()) j=c[0] ans=0 for i,v in enumerate(c): if j>v:break ans=max(b[i],ans) print(ans)