n = int(input())numbers = list(map(float, input().split()))
flag = True
for i in range(1, n):if numbers[i] >= numbers[i-1]:flag = Falseprint(i)break
if flag:print(0)
n = int(input())
numbers = list(map(float, input().split()))
flag = True
for i in range(1, n):
if numbers[i] >= numbers[i-1]:
flag = False
print(i)
break
if flag:
print(0)