import math

def f(check, n, L, count):
    count += 1
    median = int(math.floor(float(n-1)/2))
    if len(L) == 1:
        return count
    elif L[median] == check:
        return count
    elif L[median] < check:
        L = L[median+1:]
    elif check < L[median]:
        L = L[:median]
    n = len(L)
    return f(check, n, L, count)

while True:
    n = int(raw_input())
    if n == 0: break
    L = [int(raw_input()) for i in range(n)]
    check = int(raw_input())
    print f(check, n, L, 0)