#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) c=0 index=0 for i in range(1,6): t=types.count(i) if t>c: c=t index=i elif t==c and index>i: c=t index=i print(index) # your code goes here