import sys readline=sys.stdin.readline write=sys.stdout.write from math import gcd as GCD import math N=int(readline()) A=list(map(int,readline().split())) B=list(map(int,readline().split())) AB=[0]+[a^b for a,b in zip(A,B)]+[0] ans=sum(AB[i]^AB[i+1] for i in range(N+1))//2 print(ans)