N = int(input()) L = [x for x in input().split()] max_l = 0 max_cnt = 0 for i in L: if L.count(i) >= max_cnt: max_l = i print(max_l)