N = int(input())
st = input()
F = int(input())
ls = st.split()
ls = [int(l) for l in ls]
N = N//2
m=N
def newn(n,ls):
n = len(ls)
n = n // 2
return n
while len(ls)>1:
if ls[N]== F:
print(m+1)
break
else:
if ls[N]<F:
ls = ls[N:]
N = newn(N,ls)
m = m+N
else :
ls = ls[:N]
N= newn(N,ls)
m = m-N
if len(ls)==1:
if ls[0]==F:
print(m)
else:
print(0)