Vanya was given n cubes for her birthday. He and his friends decided to build a pyramid out of them. Vanya wants to build a pyramid in the following way: there should be 1 cube at the top of the pyramid, 1 + 2 = 3 cubes at the second level, 1 + 2 + 3 = 6 cubes at the third level, and so on. Thus, at the i-th level of the pyramid there should be 1 + 2 + ... + (i - 1) + i cubes. Vanya wants to know what is the maximum height of the pyramid he can create using the available cubes. Input data The first line contains an integer n (1 ≤ n ≤ 104) — the number of cubes given to Vanya. Output Print in a single line the maximum possible height of the pyramid.
a = int(input()) step = 1 step_sum = 0 while True: if step_sum + step <= a: step_sum += step step += 1 else: break print(step - 1)