#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long maxN = 2 * 1e5 + 7;
long long n, a[maxN], was[maxN];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  long long res = 0;
  for (long long i = n; i > 0; --i)
    if (!was[a[i]]) {
      was[a[i]] = true;
      res = a[i];
    }
  cout << res;
}
