#include <bits/stdc++.h>
using namespace std;
const long long MAXN = +100500;
map<long long, long long> x;
int main() {
  long long n;
  cin >> n;
  long long a[MAXN * 2];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long ans = -1;
  for (int i = n; i >= 1; i--) {
    if (x[a[i]] == 0) {
      ans = a[i];
      x[a[i]] = 1;
    }
  }
  cout << ans;
}
