n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = [ai^bi for ai,bi in zip(a,b) ] for i in range(1,n): if(c[i]==c[i-1]==1): c[i-1] -= 1 print(sum(c))