#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here maxcount = 0 maxtype = None lasttype = None types.sort(reverse=True) for x in range(0,n): currenttype = types[x] if currenttype == lasttype: currentcount+=1 if currentcount >= maxcount: maxcount = currentcount maxtype = currenttype else: currentcount = 0 lasttype = currenttype print(maxtype)