#!/bin/python3 n = int(input().strip()) types = list(map(int, input().strip().split(' '))) typeList = [1] * 5 maxi = 0 for num in types: typeList[num-1] += 1 if typeList[maxi] < typeList[num-1] or (typeList[maxi] == typeList[num-1] and (num - 1 < maxi)): maxi = num - 1 print(maxi + 1)