#include <bits/stdc++.h>
using namespace std;
int a[1000001];
bool used[1000001];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  int ans = -1;
  for (int i = n; i >= 1; --i) {
    if (!used[a[i]]) {
      ans = a[i];
      used[a[i]] = true;
    }
  }
  cout << ans;
}
