T = int(input())
for _ in range(T):
    N = int(input())
    red1 = list(map(int, input().split()))
    red2 = list(map(int, input().split()))
    parnost1 = [x % 2 for x in red1]
    parnost2 = [x % 2 for x in red2]
    srecni_skokovi = sum(1 for i in range(N) if parnost1[i] == parnost2[i])
    print(srecni_skokovi)