#include <bits/stdc++.h>
using namespace std;
int n;
map<int, int> mp;
int mini = INT_MAX;
int mincafe;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    mp[a] = i;
  }
  map<int, int>::iterator it;
  for (it = mp.begin(); it != mp.end(); it++) {
    if (it->second < mini) {
      mini = it->second;
      mincafe = it->first;
    }
  }
  cout << mincafe << endl;
}
