#include <bits/stdc++.h>
using namespace std;
const int N = 100;
const int inf = (int)1e9 + 1;
const long long big = (long long)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(20);
  int n;
  cin >> n;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    m[x] = i;
  }
  int res = inf, ans = -1;
  for (auto it : m)
    if (it.second < res) {
      res = it.second;
      ans = it.first;
    }
  cout << ans << endl;
  return 0;
}
