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 for eye,count in eye_dic.items(): if count>max_count or count==max_count and eye>max_eye: max_count = count max_eye = eye print(max_eye-2)