Count ways to represent N as XOR of distinct integers not exceeding N | C # program for the above approach ; Function to count number of ways to represent N as the Bitwise XOR of distinct integers ; Count number of subsets using above - mentioned formula ; Print the resultant count ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static void countXorPartition ( int N ) { double a = Math . Pow ( 2 , ( int ) ( N - Math . Log ( N + 1 ) / Math . Log ( 2 ) ) ) ; Console . Write ( a ) ; } public static void Main ( ) { int N = 5 ; countXorPartition ( N ) ; } }