#include
#include
using namespace std;
int search(int *a,int m, int n)
{
int s=0;
int mid;
int e=n-1;
while(s<=e)
{
mid=(s+e)/2;
if(a[mid]==m)
{
return mid;
break;
}
else if(a[mid]>m)
{
s=mid+1;
}
else
{
e=mid-1;
}
}
return -1;
}
int main() {
int n,i,m;
cin>>n;
int a[n];
for(i=0;i<n;i++)
cin>>a[i];
cin>>m;
int ans=search(a,m,n);
cout<<ans;
return 0;
}