#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) # your code goes here counter = [0] * n for type in types: counter[type] += 1 max_value = -1 max_index = -1 for i in range(n): if counter[i] > max_value: max_value = counter[i] max_index = i print(max_index)