n = int(input()) eye_dic = {} max_eye = 0 max_count = 0 for i in range(n): eye=len(input()) eye_dic[eye]=eye_dic.get(eye,0)+1 if eye_dic[eye]>max_count: max_count=eye_dic[eye] max_eye=eye elif eye_dic[eye]==max_count: max_eye=max(max_eye,eye) print(max_eye-2)