n = int(input())
s = input().split()
k = int(input())
f = -1
for i in range(len(s) - 1, -1, -1):
    if int(s[i]) == k:
        f = i + 1
        break
print(f)

/**************************************************************
	Problem: 1815
	User: admin
	Language: Python
	Result: Accepted
	Time:119 ms
	Memory:34480 kb
****************************************************************/