#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
const double EPS = 1e-4;
const int p = 41;
const int INF = 1e9 + 21;
const int MOD = 998244353;
const double pi = acos(-1);
int n, a[MAXN];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  set<int> was;
  int ans = n - 1;
  for (int i = n - 1; i > -1; i--) {
    if (!was.count(a[i])) {
      ans = i;
    }
    was.insert(a[i]);
  }
  cout << a[ans];
  return 0;
}
