Bitwise AND and XOR pair counting
Given an integer array arr of size N, the task is to count the number of pairs whose BITWISE AND and BITWISE XOR are equal.Examples:Input: N = 3, arr = Output: 1Explanation: All possible pairs from the array are pair = . we can see that pair = (0, 0), 0&0 == 0 and 0^0 == 0 this pair stratified the given condition so, we increase our answer by += 1for pair = (0, 1), 0&1 == 0 and 0^1 == 1, we can see that these are not equal we can’t increase our ans.we check for last also, in last also they are not equal.So, our…