We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- Practice
- Algorithms
- Bit Manipulation
- Sum vs XOR

# Sum vs XOR

# Sum vs XOR

Given an integer , find each such that:

where denotes the bitwise XOR operator. Print the number of 's satisfying the criteria.

For example, if , there are four values:

- .

**Function Description**

Complete the sumXor function in the editor below. It should return the number of values determined, as an integer.

sumXor has the following parameter(s):

- *n*: an integer

**Input Format**

A single integer, .

**Constraints**

**Subtasks**

- for of the maximum score.

**Output Format**

Print the total number of integers satisfying the criteria.

**Sample Input 0**

```
5
```

**Sample Output 0**

```
2
```

**Explanation 0**

For , the values and satisfy the conditions:

**Sample Input 1**

```
10
```

**Sample Output 1**

```
4
```

**Explanation 1**

For , the values , , , and satisfy the conditions: