Number of values of b such that a = b + ( a ^ b ) | function to return the number of solutions ; Driver Code
< ? php function countSolutions ( $ a ) { $ count = bitCount ( $ a ) ; $ count = ( int ) pow ( 2 , $ count ) ; return $ count ; } function bitCount ( $ n ) { $ count = 0 ; while ( $ n != 0 ) { $ count ++ ; $ n &= ( $ n - 1 ) ; } return $ count ; } $ a = 3 ; echo ( countSolutions ( $ a ) ) ; ? >