• + 0 comments

    C solution

    long sumXor(long n) {
        long count = 0;
    
        while (n > 0) {
            if ((n & 1) == 0) {
                count++;
            }
            n >>= 1;
        }
    
        return 1L << count;
    }