# -*- coding: utf-8 -*- N = input() inp = map(int, raw_input().split()) inp.sort() inp.append(0) cntmax = 0 cnt = 1 level = 0 for i in range(0, len(inp)-1): if inp[i] == inp[i+1]: cnt += cnt else: if cntmax <= cnt: cntmax = cnt level = inp[i] cnt = 1 print level