N = int(input()) S = list(map(int,input().split())) T = list(map(int,input().split())) ans_s = 0 ans_t = 0 for i in S: if i == 1: ans_s+=1 elif i == 2: ans_s += N for j in T: if j == 1: ans_t+=1 elif j == 2: ans_t += N print(max(ans_s,ans_t))