#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  int n;
  cin >> n;
  unordered_map<int, int> visits;
  int ans = INT_MAX;
  int ans_ind = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    visits[tmp] = i;
  }
  for (auto i : visits) {
    if (ans > i.second) {
      ans = i.second;
      ans_ind = i.first;
    }
  }
  cout << ans_ind;
  return 0;
}
