n = int(input()) a, b = [[*map(int, input().split())] for _ in range(2)] for i, bi in enumerate(b): a[i] = (a[i] + bi) % 2 flg = True cnt = 0 while len(a) > 0: if a.pop() == 1: if flg: cnt += 1 flg = False else: flg = True print(cnt)