
import std.stdio, std.string, std.conv, std.algorithm, std.array;

int swapCount(int[] arr, int target) {
  int min = 0, max = arr.length.to!(int) - 1;
  int counter = 1;
  while ((max - min) > 0) {
    int mean = (min + max) / 2;
    if (arr[mean] > target) max = mean - 1;
    else min = mean + 1;
    counter++;
  }
  return counter;
}

int read_num() {return readln.chomp.to!int;}

void main() {
  for(int times; readf("%d\n", &times), times != 0;) {
    int[] arr;
    foreach(t; 0..times) arr ~= read_num;    
    swapCount(arr, read_num).writeln;
  }
}