Count pairs up to N having sum equal to their XOR
Given an integer N, the task is to count the number of pairs (X, Y) such that X + Y = X ^ Y and X + Y ? N. Note: ^ denotes Bitwise xor. Examples: Input: N = 3Output: 9Explanation: The pairs satisfying the given conditions are {{0, 0}, {0, 1}, {1, 0}, {0, 2}, {2, 0}, {3, 0}, {0, 3}, {2, 1}, {1, 2}} I