#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long l1[n + 1];
    for (int i = 1; i <= n; i++) {
      cin >> l1[i];
    }
    map<long long, long long> mp;
    long long x;
    for (int i = n; i >= 1; i--) {
      if (mp[l1[i]] != 1) {
        x = l1[i];
        mp[l1[i]] = 1;
      }
    }
    cout << x;
  }
}
