t = int(input())
testovi = []
for i in range(t):
    n = int(input())
    matrica = []
    for j in range(2):
        red = list(map(int, input().split()))
        matrica.append(red)

    test = [n, matrica]
    testovi.append(test)



for i in range(t):
    sreca = 0
    for j in range(testovi[i][0]-1):
        if (testovi[i][1][1][j] % 2) == (testovi[i][1][0][j] % 2):
            sreca += 1
        if (testovi[i][1][0][j+1] % 2) == (testovi[i][1][1][j] % 2):
            sreca += 1
    if (testovi[i][1][1][-1] % 2) == (testovi[i][1][0][-1] % 2):
        sreca += 1
    print(sreca)