#include <bits/stdc++.h>
using namespace std;
long long n, a[200007];
set<long long> s;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s.insert(a[i]);
  }
  for (int i = n; i >= 1; i--) {
    if (s.size() == 1) {
      for (auto t : s) {
        cout << t << endl;
        return 0;
      }
    }
    if (s.count(a[i]) == 1) s.erase(a[i]);
  }
  return 0;
}
