#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > Set;
set<pair<int, int> >::iterator iter;
pair<int, int> k;
int a, p[250001], n, i, ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a;
    p[a] = i;
  }
  for (i = 0; i <= 200000; i++)
    if (p[i] > 0) Set.insert(make_pair(p[i], i));
  iter = Set.begin();
  k = *iter;
  ans = k.second;
  cout << ans << '\n';
  return 0;
}
