#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 3;
int freq[N];
int main() {
  int n, ans;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    if (freq[a[i]] == 0) {
      freq[a[i]] = 1;
      ans = a[i];
    }
  }
  cout << ans;
  return 0;
}
