N = int(input()) S = input().split() T = input().split() for i in range(1, N) : if S[i] != T[i] : print(i+1) break