# yukicoder No.79 過小評価ダメ・ゼッタイ from collections import Counter N = int(input()) L = [int(i) for i in input().split()] c = Counter(L) # 最も回答の多いレベルのリスト l = [i for (i, j) in c.items() if j == max(c.values())] # 値が最大のレベルを出力 print(max(l))