SDE Path

Find the XOR of Numbers in a Range

Medium

Find the XOR of Numbers in a Range

Compute the XOR of all integers from 1 to N in O(1) time.

Input format

A single integer N (1 ≤ N ≤ 10^9).

Output format

Print the XOR of all integers from 1 to N.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
1
Expected output
1
Example 2
Input
2
Expected output
3