XOR split
Practice
3.4 (12 votes)
Bit manipulation
Basic programming
Basics of bit manipulation
Problem
24% Success 5867 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

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

1≤T≤106

0≤N≤1018

Sample Input
2
0
5
Sample Output
0
1
Explanation

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

For the next testcase possible numbers are 4 and 1.

Code Editor

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Submissions
Please login to view your submissions
Similar Problems
Points:20
602 votes
Tags:
Easy
Points:20
196 votes
Tags:
EasyHash MapsOpen
Points:20
42 votes
Tags:
AlgorithmsApprovedBit manipulationEasyOpen
Editorial

Login to unlock the editorial