for i, n, m in zip(range(int(input())), input().split(), input().split()): if n != m: print(i+1) break