#!/bin/python3 import sys from collections import defaultdict n = int(input().strip()) cts = defaultdict(int) for typ in map(int, input().strip().split(' ')): cts[typ] += 1 print(-max((ct, -typ) for typ, ct in cts.items())[1])