#include <bits/stdc++.h>
using namespace std;
map<int, bool> been;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int last = -1;
  for (int i = n - 1; i >= 0; i--) {
    if (been[a[i]] == false) {
      been[a[i]] = true;
      last = a[i];
    }
  }
  cout << last;
  return 0;
}
