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: class GFG { static int countSolutions ( int a ) { int count = bitCount ( a ) ; count = ( int ) System . Math . Pow ( 2 , count ) ; return count ; } static int bitCount ( int n ) { int count = 0 ; while ( n != 0 ) { count ++ ; n &= ( n - 1 ) ; } return count ; } public static void Main ( ) { int a = 3 ; System . Console . WriteLine ( countSolutions ( a ) ) ; } }