You are XORing p with all the elements of A[i]. XOR might look like a O(1) but it actually has to check all the bits and then it provides you with the XOR.
Use these property: TLE in ENGXOR - #3 by hackinet
Furthermore, you just need to iterate over arr[i] only 1 time. Count how many numbers have even bits or odd bits.
Take input p. Check if p has even bits or odd bits. You have your answer.