Hide

Problem G
Human Pyramid

/problems/humanpyramid/file/statement/en/img-0001.jpg
An example of a non-world record breaking pyramid. CC BY-SA 3.0 by Amotoki on Wikimedia Commons.

As chairman of the Building A Pyramid Committee, you are specialized in breaking one specific world record: building the highest human pyramid. Unfortunately, you only know a limited number of people who are willing to be in the pyramid. After all, building human pyramids does not make much money, so most people are volunteers.

A full human pyramid of height $h$ consists of $h$ layers of people. As seen from below, it has $h$ people on the first layer, $h-1$ on the second, $h-2$ on the third, and so forth until eventually the final layer has just a single person. To determine whether you can break the world record, you need to know how high a pyramid you can build. Given how many people are available, how tall is the highest possible human pyramid that these people can make?

Input

The input consists of:

  • One line with an integer $n$ ($1 \leq n \leq 10^{12}$), the number of people available to build the pyramid.

Output

Output the height of the highest possible pyramid you can build with $n$ people.

Sample Input 1 Sample Output 1
3
2
Sample Input 2 Sample Output 2
12
4

Please log in to submit a solution to this problem

Log in