#include <bits/stdc++.h>
using namespace std;
int main() {
  int g, i, j, a[201000];
  int n;
  for (g = 0; g < 201000; g++) a[g] = 210000;
  cin >> n;
  for (g = 1; g < n + 1; g++) {
    int ag;
    cin >> ag;
    a[ag] = g;
  }
  int mi = 201000, maz;
  for (g = 0; g < 200001; g++) {
    if (mi > a[g]) {
      mi = a[g];
      maz = g;
    }
  }
  cout << maz;
  return 0;
}
