#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here from collections import Counter c = Counter(types) m = c.most_common() mk, mv = m[0] cand = [mk] for k, v in m: if v == mv: cand.append(k) print min(cand)