#include <bits/stdc++.h>
int n, a, b[200010] = {0}, ans, min = 200010;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    b[a] = i;
  }
  for (int i = 0; i <= 200000; i++)
    if (b[i] && b[i] < min) {
      min = b[i];
      ans = i;
    }
  printf("%d\n", ans);
  return 0;
}
