#include
using namespace std;
int search(int a[],int s,int e,int key)
{
int mid=(s+e)/2;
if(a[mid] == key)
return mid;
if(a[s]<=a[mid])
{
if((key>=a[s])&&(key<=a[mid]))
return (a,s,mid-1,key);
else return (a,mid+1,e,key);
}
if((key>=a[mid]) && (key<=a[e]))
return (a,mid+1,e,key);
else return (a,s,mid-1,key);
}
int main()
{
int a;
cin>>a;
int arr[a];
for(int i=0;i<a;i++)
cin>>arr[i];
cout<<"Enter Key :";
int key;
cin>>key;
cout<<"At index "<<search(arr,0,a-1,key)<<endl;
}