Baby Oreo

View as PDF

Submit solution

Points: 5
Time limit: 1.5s
Memory limit: 64M

Author:
Problem type

Sharmin likes Oreos. In fact, he likes them so much that he currently has N of them at his home.

Sharmin wants to maximize the number of days he can eat his Oreos for, but also wants to eat a different amount of Oreos each day. If he still has Oreos, but he already ate that amount on a previous day, he will give the remaining Oreos to his friend.

Given the constraints, Sharmin wants to know the maximum number of days he can eat Oreos for. Can you help him?

Note that Sharmin must eat a nonzero amount of Oreos each day.

Constraints

1 \le N \le 10^{12}

Input Specification

The first and only line will contain one integer N.

Output Specification

Output one integer, the maximum number of days Sharmin can eat Oreos for given the constraints.

Sample Input 1

53

Sample Output 1

9

Sample Explanation 1

Sharmin can eat the Oreos as follows: [6, 8, 3, 9, 10, 1, 7, 5, 4].

Sample Input 2

123971239871

Sample Output 2

497937

Comments

There are no comments at the moment.