#include <bits/stdc++.h>
using namespace std;
const int SIZE = 200009 + 6;
const int OO = (int)1e9;
const double PI = acos(-1);
bool isprime[SIZE + 30];
int primes[SIZE + 30], it = 0;
bool v[SIZE];
int main() {
  int n;
  scanf("%d", &n);
  int arr[SIZE];
  int cnt = 0;
  vector<int> ve;
  for (int i = 0; i < n; i++) {
    scanf("%d", arr + i);
  }
  if (n == 1) {
    printf("%d", arr[0]);
    return 0;
  }
  for (int i = n - 1; i >= 0; i--) {
    if (!v[arr[i]]) {
      cnt++;
      v[arr[i]] = 1;
      ve.push_back(i);
    }
  }
  sort(ve.begin(), ve.end());
  printf("%d", arr[ve[0]]);
}
