import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] arr = new int[n];
int i =0;
while(i<n){
arr[i] = scan.nextInt();
i++;
}
int m = scan.nextInt();
int result = binarySearch(arr,m);
System.out.println(result);
}
public static int binarySearch(int[] arr, int m){
int low = 0;
int high = arr.length-1;
while(low<=high){
int mid = low+high/2;
if(arr[mid]>m){
high=mid-1;
}
else if(arr[mid]<m){
low = mid+1;
}
else{
return(mid);
}
}
return -1;
}
}