text: Number of values of b such that a = b + ( a ^ b ) | C ++ program to find the number of values of b such that a = b + ( a ^ b ) ; function to return the number of solutions ; Driver Code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; int countSolutions ( int a ) { int count = __builtin_popcount ( a ) ; count = pow ( 2 , count ) ; return count ; } int main ( ) { int a = 3 ; cout << countSolutions ( a ) ; }