#P6581. 远大目标

远大目标

Background

As everyone knows, the loftiest goal of an OIer is to get AK at IOI.

(Image from “From Beginner to Pro: Programming Contest Basics”.)

As an OIer, Little Z also wants to AK IOI. But he is still too weak: even saying I AK IOI would make the top players look down on him.

So, Little Z can only say |A|<|O| to encourage himself.

However, the expert Youyou saw it and felt it was ridiculous, saying: With your level you still want to AK IOI? Fine, since you said |A|<|O|, I will give you a problem to do.

Poor Little Z is really too weak and cannot solve even this problem, so he has to ask you for help—the future IOI AKer.

Problem Description

Given OO, find the number of integers AA such that A<O|A|<O.

Since Little Z is too weak, he does not even dare to say |A|<|O|, and can only study the problem |A|<O.

Input Format

One line with one integer OO.

Output Format

One line with one integer: the number of integers AA that satisfy the condition.

3
5
1145141919810
2290283839619
12345
24689

Hint

Sample 1 Explanation

Possible values of AA are 1-1, 00, and 11.

Constraints

  • Subtask 1 (30 points): 0O21010 \le |O| \le 2^{10}-1;
  • Subtask 2 (60 points): 0O23110 \le |O| \le 2^{31}-1;
  • Subtask 3 (10 points): 0O26310 \le |O| \le 2^{63}-1.

O|O| denotes the absolute value of OO.

Hint

If you do not know what absolute value is, you can understand it as:

$$|x| = \begin{cases} x & (x > 0) \\ 0 & (x = 0) \\ -x & (x < 0)\end{cases}$$

Original idea: Meatherm

Translated by ChatGPT 5