• + 0 comments

    My Below code is failing for some test case kindly help me where i did mistake.

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
    
        long n = in.nextLong();
    
        System.out.println(LongStream.range(0, n).filter(num -> ((n+num) == (n^num))).count());
    
    }