#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) # your code goes here d=dict() for i in types: d[i]=d.get(i,0)+1 k=sorted(list(d.keys())) v=list(d.values()) x=max(v) for i in k: if d[i] is x: break print(i)