#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a[n]; for(int i=0; i<n; i++){ cin>>a[i]; } sort(a , a+n); int key; cin>>key; int *ptr; // for lower bond ptr = lower_bound( a, a+n, key) ; if(*ptr ==key) cout << (*ptr) << " "; else cout << "\n key not found"; // for upper lower_bound ptr= upper_bound( a, a+n, 4) ; cout << (*ptr) ; return 0; }