#include<iostream>
using namespace std;
int binary(int a[],int l,int r,int k){
if(r>=l){
int m=(r+l)/2;
if (a[m]==k)
return m;
if (a[m]>k)
return binary(a,l,m-1,k);
return binary(a,m+1,r,k);
}
return -1;
}
int main(){
int n;
cout<<"Enter the no.of elements:";
cin>>n;
int a[n];
cout<<"Enter the array elements:";
for(int i=0;i<n;i++){
cin>>a[i];
}
int k;
cout<<"Enter the search element:";
cin>>k;
int j = binary(a,0,n-1,k);
cout<<endl<<"--"<<j;
}