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