#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here b_count = {} for i in types: if i not in b_count.keys(): b_count[i] = types.count(i) id = max(b_count, key=b_count.get) print id