St Andrews Online Judge

Sigma XOR

By Kay Akashi

Time: 1000 ms
Memory: 256000 kB

The code judging system is only available during contests. Check out the github repo for test cases and solutions.

Please log in.

Problem Statement

Given a positive integer NN, answer the value of 12...N1 ⊕ 2 ⊕ ... ⊕ N, where signifies XOR operation.

Note that, in XOR operation of two integers, each bit of two integers in binary format is calculated in the following manner: 00=00 ⊕ 0 = 0, 01=10 ⊕ 1 = 1, 10=11 ⊕ 0 = 1, 11=01 ⊕ 1 = 0. For example, 12(10)34(10)=001100(2)100010(2)=101110(2)=46(10)12_{(10)} ⊕ 34_{(10)} = 001100_{(2)} ⊕ 100010_{(2)} = 101110_{(2)} = 46_{(10)}.

Constraints

1N10151 \leq N \leq 10^{15}.

Subtask 1 (20%)

1N<1051 \leq N \lt 10^{5}.

Subtask 2 (80%)

105N101510^{5} \leq N \leq 10^{15}.

Input

The input consists of one integer, NN.

Output

Output the answer.

Examples

Input

14

Output

15

Explanation

12...14=151 ⊕ 2 ⊕ ... ⊕ 14 = 15.

Input

1

Output

1

Explanation

Note that when N=1N = 1 we do not perform any operation.

Input

392857971529353

Output

1

Explanation

May I please skip the explanation for this.