#yuki706 import operator n=int(raw_input()) s=[] for i in xrange(n): t=raw_input() s.append(t.count('^')) u=[0 for i in xrange(1001)] for i in xrange(n): u[s[i]]+=1 print max(zip(u, range(len(u))))[1]