N = int(eval(input()))

a = list(map(int,input().split()))

b = 1

for i in range(N):

    if b == a[i]:

        b += 1

if b == 1:

    print((-1))

else:

    print((N-b+1))
N = int(eval(input()))

a = list(map(int,input().split()))

b = 1

for i in a:

    if b == i:

        b += 1

if b == 1:

    print((-1))

else:

    print((N-b+1))
N = int(eval(input()))
a = list(map(int, input().split()))
b = 1
for i in range(N):
    if b == a[i]:
        b += 1
if b == 1:
    print((-1))
else:
    print((N - b + 1))

N = int(eval(input()))
a = list(map(int, input().split()))
b = 1
for i in a:
    if b == i:
        b += 1
if b == 1:
    print((-1))
else:
    print((N - b + 1))

-for i in range(N): -    if b == a[i]: +for i in a: +    if b == i: