#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> s;
  vector<int> A;
  int n, last;
  cin >> n;
  for (int i = 0, sh; i < n; i++) {
    cin >> sh;
    A.push_back(sh);
  }
  for (int i = n - 1; i > -1; i--) {
    if (s.find(A[i]) == s.end()) {
      s.insert(A[i]);
      last = A[i];
    }
  }
  cout << last;
  return 0;
}
