N=int(input()) S=list(map(int, input().split())) T=list(map(int, input().split())) from collections import Counter as co A=co(S) B=co(T) cnt=N*(A[2]+B[2])-A[2]*B[2] if A[2]==0 and B[2]==0: cnt+=max(A[1],B[1]) elif A[2]==0 and B[2]>0: cnt+=B[1] elif A[2]>0 and B[2]==0: cnt+=A[1] print(cnt)