atcoder#ARC070A. [ABC056C] Go Home

[ABC056C] Go Home

Score : 200200 points

Problem Statement

There is a kangaroo at coordinate 00 on an infinite number line that runs from left to right, at time 00. During the period between time i1i-1 and time ii, the kangaroo can either stay at his position, or perform a jump of length exactly ii to the left or to the right. That is, if his coordinate at time i1i-1 is xx, he can be at coordinate xix-i, xx or x+ix+i at time ii. The kangaroo's nest is at coordinate XX, and he wants to travel to coordinate XX as fast as possible. Find the earliest possible time to reach coordinate XX.

Constraints

  • XX is an integer.
  • 1X1091 \leq X \leq 10^9

Input

The input is given from Standard Input in the following format:

XX

Output

Print the earliest possible time for the kangaroo to reach coordinate XX.

6
3

The kangaroo can reach his nest at time 33 by jumping to the right three times, which is the earliest possible time.

2
2

He can reach his nest at time 22 by staying at his position during the first second, and jumping to the right at the next second.

11
5