#include <bits/stdc++.h>
using namespace std;
int main() {
  const int N = 200010;
  int n, Num[N], i, size, ans;
  bool A[N];
  cin >> n;
  fill(A, A + n, false);
  for (i = 0; i < n; i++) cin >> Num[i];
  for (i = n - 1; i >= 0; i--) {
    if (!A[Num[i]]) ans = Num[i];
    A[Num[i]] = true;
  }
  cout << ans;
}
