from collections import Counter def main(): N = int(input()) c = Counter(map(int, input().split())) mc = c.most_common() max_count = mc[0][1] m = filter(lambda t: t[1] == max_count, mc) level = list(m)[-1][0] print(level) if __name__ == '__main__': main()