SOLVE

LATER

Xor is Mad

Problem

Editorial

Analytics

The problem is straight and simple.

Given a number *X* ,find how many positive *A* ( \(A\gt 0)\) exists, such that

1. *A* \(\newcommand*\xor{\mathbin{\oplus}}\) *X* =*A* + *X*

2. *A* \(\lt\) *X*

**Input:**

The first line of the input will contain *T* , the number of test-cases.

Next *T* lines will contain integer *X* .

**Output:**

For each test-case , output the answer in a separate line.

**Constraints:**

- \(1 \le T \le 10^5\)
- \(1 \le X \le 10^7\)

Explanation

**Explanation for 1st test case:**

For *1* there is no such number.

**For 2nd case:**

For *2* we have only one such number *1* \(\newcommand*\xor{\mathbin{\oplus}}\) *2* = *3*

**For 3rd case:**

For number *3* we have no such number .

**For 4th case:**

For number *4* we have *3* \(\oplus\) *4* = *7* , *2* \(\oplus\) *4* = *6* and *1* \(\oplus\) *4* = *5*. Hence the answer is 3.

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Swift-4.1,
Visual Basic

Initializing Code Editor...

Challenge Name

EnableMyTeam Java/Javascript Hiring Challenge

EnableMyTeam Java/Javascript Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE

{"68d53e7": "/pagelets/suggested-problems/algorithm/xor-is-mad-77/", "f118948": "/pagelets/problem-author-tester/algorithm/xor-is-mad-77/", "c7d0c11": "/pagelets/show-submission/algorithm/xor-is-mad-77/", "f917bbd": "/pagelets/recommended-problems/algorithm/xor-is-mad-77/", "2f51259": "/pagelets/problems-hint/algorithm/xor-is-mad-77/"}

realtime.hackerearth.com

80

9da5d797bc632bb29b42217dbe997774ac341729

58a29e5cae2309f04b28

/realtime/pusher/auth/