/* * Migratory Bird * * Joel Enriquez * 2017/02/11 * */ #include #include #include using namespace std; int main(){ int n; cin >> n; vector types(n); for (int i = 0; i < n; i++) { cin >> types[i]; } // hash values to calculate frequency int max = 0; vector hash(n); for (int i = 0; i < n; i++) { hash[types[i] - 1]++; if (max < hash[types[i] - 1]) { max = hash[types[i] - 1]; } } // make sure to get lowest id int type = 0; for (int i = 0; i < n; i++) { if (max == hash[i]) { type = i + 1; break; } } cout << type << endl; return 0; }