Help me in solving ST12 problem

My issue

My code

# The code below is incorrect. Debuf this code to solve the problem.

t = int(input())
for i in range(t):
    n = int(input())
    S = input()
    R = input()
    
    count = 0
    for i in range(n):
        if S[i]==R[i]:
            count = count + 1
    if count%2==1:
        print(1)
    else:
        print(0)

Learning course: Solve Programming problems using Python
Problem Link: CodeChef: Practical coding for everyone

@yashmala - you have changed the while to for loop.

however, the underlying logical error in the code is not yet fixed.
if S[i]==R[i]: is this the right logic flow?

actually i am not able to understand which logic should i apply in this and how to apply it and don’t know how the solution which is given is solving the problem.
do u have any link of any video or reference for the underlying concept behind this problem.