#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here count = {} for i in types: if i in count: count[i] = count[i] + 1 else: count[i] = 1 print list(filter(lambda t: t[1]==max(count.values()), count.items()))[0][0]