#include <bits/stdc++.h>
using namespace std;
int cont[200001];
int main() {
  int x;
  cin >> x;
  for (int i = 0; i < x; i++) {
    int y;
    cin >> y;
    cont[y] = i + 1;
  }
  int minimo = 100000000;
  int ans = 0;
  for (int i = 0; i < 200001; i++) {
    if (cont[i] == 0) continue;
    if (minimo > cont[i]) {
      minimo = cont[i];
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}
