n = int(input()) s = list(map(int, input().split())) t = list(map(int, input().split())) s1 = s.count(1) t1 = t.count(1) s2 = s.count(2) t2 = t.count(2) if s2 == 0 and t2 == 0: print(max(s1, t1)) elif s2 > 0 and t2 > 0: print((s2 + t2) * n - s2 * t2) elif s2 == 0: print(t1 + t2 * n) elif t2 == 0: print(s1 + s2 * n)