#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) # your code goes here m = {} for b in types: if b in m: m[b] += 1 else: m[b] = 1 mxi = 0 mx = 0 for k in sorted(m.keys()): if m[k] > mx: mxi = k mx = m[k] print (mxi)