#include
#include
#include
using namespace std;
int main() {
int n;
cin >> n;
vector v;
for(int i = 0; i < n; i++) {
int x;
cin >> x;
v.push_back(x);
}
sort(v.begin(), v.end());
int x;
cin >> x;
int idx = lower_bound(v.begin(), v.end(), x) - v.begin();
if(idx >= 0 and idx < v.size()) {
cout << v[idx] << endl;
}
else {
cout <<"VAKOV ELEMENT NE POSTOI" << endl;
}
return 0;
}