#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) s=list(set(types)) a=[] for i in s: b=[0,0] b[0]=n-types.count(i) b[1]=i a.append(b) a.sort() print a[0][1] # your code goes here