N = int(input()) S = list(map(int,input().split())) T = list(map(int,input().split())) ssum = 0 tsum = 0 for s in S: if s==1: ssum+=1 if s==2: ssum+=N for t in T: if t==1: tsum+=1 if t==2: tsum+=N print(max(ssum,tsum))