import sys from itertools import pairwise def input(): return sys.stdin.readline().rstrip('\n') def main(): n = int(input()) a = [0] + list(map(int, input().split())) + [0] b = [0] + list(map(int, input().split())) + [0] d = [x ^ y for x, y in pairwise(a)] e = [x ^ y for x, y in pairwise(b)] f = [x ^ y for x, y in zip(d, e)] return sum(f) // 2 if __name__ == '__main__': ret = main() if ret is not None: print(ret)