問題一覧 > 通常問題

No.2853 A + B Problem

レベル : / AI推定難易度 : 500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 132
作問者 : dyktr_06 / テスター : ryota2357
お気に入りにしたユーザー ProblemId : 11301 / 自分の提出
問題文最終更新日: 2024-08-21 21:37:39
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 442 MMA Contest 019 (順位表) の他の問題:

Problem Statement

Among integers satisfying $1 \leq A, B \leq N$, how many pairs $(A, B)$ satisfy both of the following conditions?

  • $A + B = N$
  • $A \ \mathrm{AND} \ B = 0$

Here, $\mathrm{AND}$ denotes the bitwise logical AND.

It can also be proved that, under the constraints of the problem, the answer is less than $2^{60}$.


Constraints

  • $1 \leq N < 2^{60}$
  • All inputs are integers.

Input

The input is given from standard input in the following format.

$N$

Output

Print the answer to the problem on one line.

Sample

Sample 1
Input
5
Output
2

$(A, B) = (1, 4), (4, 1)$ satisfy the conditions.

Sample 2
Input
1125899906842624
Output
0

Note that the input may not fit in a $32$ bit integer type.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。