#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<int> a;
  set<int> b;
  set<int>::iterator it;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
    b.insert(t);
  }
  int c = b.size();
  int i = n - 1;
  while (c != 1) {
    it = b.find(a[i]);
    if (it != b.end()) {
      b.erase(it);
      c--;
    }
    i--;
  }
  for (it = b.begin(); it != b.end(); ++it) cout << *it;
}
