XOR split

3.4

12 votes
Bit Manipulation, Basic Programming, Basics of Bit Manipulation
Problem

You are given a number N. Your task is to find if there exist two distinct natural numbers such that their bitwise XOR is N and bitwise AND is 0. If such numbers exist, then print 1. Otherwise, print 0.

 Input format

  • The first line contains T denoting the number of test cases.
  • The first line of each test case contains an integer N.

Output format

For each test case, print the answer.

Constraints

1T106

0N1018

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

For the first testcase we can't find two numbers.

For the next testcase possible numbers are 4 and 1.

Editor Image

?