#include <bits/stdc++.h>
using namespace std;
long long par[105][105];
int main() {
  int n;
  cin >> n;
  int temp;
  map<int, int> mpp;
  pair<int, int> mx;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    mpp[temp]++;
    if (mpp[temp] > mx.second) {
      mx.first = temp;
      mx.second = mpp[temp];
    }
  }
  cout << mx.first << endl;
}
