#include <bits/stdc++.h>
bool n[200005];
int num[200005];
int main() {
  int a;
  while (~scanf("%d", &a)) {
    memset(n, 0, sizeof(n));
    for (int i = 0; i < a; i++) {
      scanf("%d", &num[i]);
    }
    int jie;
    for (int i = a - 1; i >= 0; i--) {
      if (n[num[i]] == false) {
        n[num[i]] = true;
        jie = num[i];
      }
    }
    printf("%d\n", jie);
  }
  return 0;
}
