#include<bits/stdc++.h>
using namespace std;
int BINARY_SEARCH(int *ARR,int &N,int &ITEM)
{
int LB=0,UB=N-1;
while(LB<=UB)
{
int MID=(LB+UB)/2;
if(ARR[MID]==ITEM)
return MID;
else if(ARR[MID]<ITEM)
LB=MID+1;
else
UB=MID-1;
}
return -1;
}
int main()
{
int N,ITEM,lOC;
cin>>N;
int ARR[N];
for(int i=0;i<N;i++)
cin>>ARR[i];
cin>>ITEM;
int LOC=BINARY_SEARCH(ARR,N,ITEM);
if(LOC==-1)
cout<<"ITEM is not in the ARRAY" <<endl;
else
cout<<"ITEM "<<ITEM<<" is in the location "<<LOC+1<<endl;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBCSU5BUllfU0VBUkNIKGludCAqQVJSLGludCAmTixpbnQgJklURU0pCnsKICAgIGludCBMQj0wLFVCPU4tMTsKICAgIHdoaWxlKExCPD1VQikKICAgIHsKICAgICAgICBpbnQgTUlEPShMQitVQikvMjsKCiAgICAgICAgaWYoQVJSW01JRF09PUlURU0pCiAgICAgICAgICAgIHJldHVybiBNSUQ7CiAgICAgICAgZWxzZSBpZihBUlJbTUlEXTxJVEVNKQogICAgICAgICAgICBMQj1NSUQrMTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIFVCPU1JRC0xOwogICAgfQogICAgcmV0dXJuIC0xOwp9CgoKaW50IG1haW4oKQp7CiAgICBpbnQgTixJVEVNLGxPQzsKICAgIGNpbj4+TjsKICAgIGludCBBUlJbTl07CiAgICBmb3IoaW50IGk9MDtpPE47aSsrKQogICAgICAgIGNpbj4+QVJSW2ldOwogICAgY2luPj5JVEVNOwoKICAgIGludCBMT0M9QklOQVJZX1NFQVJDSChBUlIsTixJVEVNKTsKCiAgICBpZihMT0M9PS0xKQogICAgICAgIGNvdXQ8PCJJVEVNIGlzIG5vdCBpbiB0aGUgQVJSQVkiIDw8ZW5kbDsKICAgIGVsc2UKICAgICAgICBjb3V0PDwiSVRFTSAiPDxJVEVNPDwiIGlzIGluIHRoZSBsb2NhdGlvbiAiPDxMT0MrMTw8ZW5kbDsKCiAgICByZXR1cm4gMDsKfQ==