from collections import Counter n = int(input().strip()) types = list(map(int, input().strip().split(' '))) cnt = Counter(types).most_common() max,mx= 0,0 for occ in cnt: if(max < occ[1]): max = occ[1] mx=occ[0] print(mx)