n = int(raw_input().strip()) s = (raw_input().strip()) d = {} L= [] L = s.split() for i in range(n): if L[i] not in d: d[L[i]] = 1 else: d[L[i]] += 1 max = 0 t = 6 for j in d: if (d[j] > max) or ((d[j] == max) and (int(j)