def ind(l, i):
    c=-1
    flag=0
    for j in l:
        c+=1
        if i == j:
            flag = 1
            print(c)
    if flag == 0:
        print(-1)
            

while True:
    try:
        n = int(input())
        l = list(map(int, input().split()))
        i = int(input())
        ind(l, i)
    except:
        break