from collections import Counter class Problem0079: def solve(this): n = int(input()) l = list(map(int, input().split())) l = sorted(l, reverse=True) print(Counter(l).most_common()[0][0]) if __name__ == "__main__": problem = Problem0079() problem.solve()