Help me in solving MISSP problem

My issue

I am not able to create a much better logic so that my code becomes more efficient

My code

# cook your dish here
def search(A,n):
    count=0
    for i in range (n):
        for j in range (n):
            if i+1==A[j]:
            #    print(i,A[j])
               count+=1 
               break
    print(count)


t=int(input())
for _ in range (t):
    N=int(input())
    dolls=[]
    for i in range (N):
        x=int(input())
        dolls.append(x)
    search(dolls,N)

Learning course: Arrays, Strings & Sorting
Problem Link: Practice Problem in - CodeChef

@shreetej07
The better logic would be take the xor of the whole array .
and the answer would be it because xor would cancel out the duplicates and will only contain the odd one in the end.