n = int(input())
l = [int(x) for x in input().split(" ")]
flag = True
for i in range(1, len(l)):
	if l[i] < l[i-1]:
		print(i+1)
		flag = False
		break
if flag:
	print(0)
3263b4cdc72467276c7a7208acc336c86285c827
<mask token>

<mask token>
for i in range(1, len(l)):
    if l[i] < l[i - 1]:
        print(i + 1)
        flag = False
        break
if flag:
    print(0)

n = int(input())
l = [int(x) for x in input().split(' ')]
flag = True
for i in range(1, len(l)):
    if l[i] < l[i - 1]:
        print(i + 1)
        flag = False
        break
if flag:
    print(0)

n = int(input())
l = [int(x) for x in input().split(" ")]
flag = True
for i in range(1, len(l)):
	if l[i] < l[i-1]:
		print(i+1)
		flag = False
		break
if flag:
	print(0)