#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here b = {x:types.count(x) for x in set(types)} print max(b, key=lambda i: b[i])