#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, l, k, i, a[200005], b[200005], j, ans = 0, h[200005];
  cin >> n;
  for (i = 0; i <= 200000; i++) {
    b[i] = 0;
  }
  for (i = 0; i < n; i++) {
    cin >> a[i];
    b[a[i]]++;
  }
  for (i = 0; i < n; i++) {
    b[a[i]]--;
    if (b[a[i]] == 0) {
      cout << a[i];
      return 0;
    }
  }
  return 0;
}
