#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) types_id=(1,2,3,4,5) # your code goes here while n not in xrange(5,2*10**5+1): print "enter n in range 5 to 2*10^5" n = int(raw_input().strip()) if len(types) != n: print "enter correct number of types equal to n" sys.exit(1) for t in types: if t not in types_id: print "enter correct type" sys.exit(2) types_dct={1:0,2:0,3:0,4:0,5:0} for t in types: types_dct[t]+=1 #tkeys=sorted(types_dct.keys()[:]) tvalues=types_dct.values() m=max(tvalues) t_lst=[] for k,v in types_dct.iteritems(): if m==v: t_lst.append(k) print min(t_lst)