#C10703. Seashell Rows

    ID: 39938 Type: Default 1000ms 256MiB

Seashell Rows

Seashell Rows

Sarah has collected a number of seashells and wishes to arrange them in rows on the beach. The first row requires 1 seashell, the second row requires 2 seashells, the third row requires 3 seashells, and so on. Given the total number of seashells n, your task is to calculate the maximum number of complete rows that can be formed. In mathematical terms, you need to find the largest integer k such that

\(1 + 2 + \cdots + k = \frac{k(k+1)}{2} \leq n\)

For example, if n = 10, then the answer is 4 because 1 + 2 + 3 + 4 = 10. Similarly, if n = 7, then the maximum complete rows you can form is 3 since 1 + 2 + 3 = 6 and 1 + 2 + 3 + 4 = 10 which exceeds 7.

inputFormat

The input consists of a single integer n on a single line, representing the total number of seashells.

outputFormat

Output a single integer which is the maximum number of complete rows that can be formed.

## sample
10
4