#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> a;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    a[k] = i;
  }
  cout << (*(min_element(a.begin(), a.end(),
                         [](pair<int, int> first, pair<int, int> second) {
                           return first.second < second.second;
                         })))
              .first
       << endl;
  return 0;
}
