Calculate the number of unordered pairs in an array whose bitwise “AND” is a power of 2 in O(n) or O(n*log(n))?

Can anyone help me with the above question, I am also attaching a related post from StackOverflow for better clarification?

Can anyone help me with the above question, I am also attaching a related post from StackOverflow for better clarification?