from collections import Counter N, *L = map(int, open(0).read().split()) C = Counter(L).most_common() C.sort(key=lambda x: -x[0]) print(C[0][0])