#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n;
  map<int, int> a;
  for (int i = 0; i < n; i++) {
    cin >> k;
    a[k] = i;
  }
  int minval = n + 10, numofmin;
  for (auto it = a.begin(); it != a.end(); it++) {
    if (it->second < minval) {
      minval = it->second;
      numofmin = it->first;
    }
  }
  cout << numofmin;
  return 0;
}
