思路:大水题
#include <cstdio>
#include <queue>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <ctime>
#include <cmath>
#include <cctype>
using namespace std;
#define maxn 1000005
#define LL long long
int cas=1,T;
map<int,int>a;
int main()
{
int n;
while (scanf("%d",&n)!=EOF)
{
int ans = 0,maxx=0;
for (int i = 0;i<n;i++)
{
int temp;
scanf("%d",&temp);
a[temp]++;
if (a[temp]>maxx)
{
maxx=a[temp];
ans=temp;
}
}
printf("%d\n",ans);
}
//freopen("in","r",stdin);
//scanf("%d",&T);
//printf("time=%.3lf",(double)clock()/CLOCKS_PER_SEC);
return 0;
}