for i, n, m in range(int(input())), input().split(), input().split(): if n is not m: print(i+1) break