#include <bits/stdc++.h>
using namespace std;
void fscpp() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void fs(long long &x) {
  bool neg = false;
  register long long c;
  x = 0;
  c = getchar();
  if (c == '-') {
    neg = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) x = (x << 1) + (x << 3) + c - 48;
  if (neg) x *= -1;
}
long long int expo(long long int x, unsigned long long int y, long long int p) {
  int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res % p * x % p) % p;
    y = y >> 1;
    x = (x % p * x % p) % p;
  }
  return res % p;
}
int main() {
  fscpp();
  long long t, ct, n, r, f, m, l;
  vector<pair<long long, long long> > s;
  map<long long, long long> a;
  cin >> t;
  for (long long int i = 0; i < t; i++) {
    cin >> r;
    a[r] = i + 1;
  }
  for (std::map<long long, long long>::iterator it = a.begin(); it != a.end();
       ++it) {
    s.push_back(make_pair(it->second, it->first));
  }
  sort(s.begin(), s.end());
  pair<long long, long long> p = s[0];
  cout << p.second << "\n";
  return 0;
}
