#include using namespace std; typedef long long ll; int main() { int n; cin >> n; map m; for (int i = 0; i < n; ++i) { int l; cin >> l; m[l]++; } int ma = 0; int ans = -1; for (auto &e: m) { if (e.second >= ma) { ma = e.second; ans = e.first; } } cout << ans << '\n'; return 0; }