#include <stdio.h>
main(){
  while(1){
  int a,n[100],i,key,l=0,r,mid,c=0;
    scanf("%d",&a);
    if(a==0) break;
    for(i=0;i<=a;i++){
      scanf("%d",&n[i]);
    }
    key=n[a];
    r=a-1; 
    while(l<=r){
      mid=(l+r)/2;
      c++;
      if(n[mid]==key) break;
      else if(n[mid]<key) l=mid+1;
      else r=mid-1;
    }
    printf("%d\n",c);
  } 
  return 0; 
}