#include #include using namespace std; int main(void) { int n; cin >> n; set nums; int max_x = 0; while (n--) { int x; cin >> x; auto it = nums.find(x); if (it != nums.end()) { max_x = max(max_x, x); } nums.insert(x); } if (max_x == 0) { cout << "nema" << endl; } else { cout << max_x << endl; } return 0; }