给定 $n$,求下式的值:
$$\sum_{i=1}^{n-1} i \oplus (n - i)$$
其中 $\oplus$ 表示按位异或运算。
输入格式
输入包含一个整数 $n$ ($2 \le n < 10^{500}$)。
输出格式
输出一个整数,即该求和的结果。
样例
输入 1
3
输出 1
6
输入 2
4
输出 2
4
给定 $n$,求下式的值:
$$\sum_{i=1}^{n-1} i \oplus (n - i)$$
其中 $\oplus$ 表示按位异或运算。
输入包含一个整数 $n$ ($2 \le n < 10^{500}$)。
输出一个整数,即该求和的结果。
3
6
4
4
The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.
This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.
If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.
Guidelines: