#K81362. Find the N-th Term of a Custom Sequence

    ID: 35737 Type: Default 1000ms 256MiB

Find the N-th Term of a Custom Sequence

Find the N-th Term of a Custom Sequence

You are given a positive integer n. You need to determine the n-th term of a special sequence where each positive integer k appears exactly k times. The sequence is defined as:

1, 2, 2, 3, 3, 3, 4, 4, 4, 4, ...

More formally, for a given position n, find the smallest integer k such that:

$$\sum_{i=1}^{k} i = \frac{k(k+1)}{2} \geq n.$$

For example, if n = 5, the answer is 3 because the 5th element in the sequence is 3.

inputFormat

The input consists of a single integer n provided via standard input.

outputFormat

Output a single integer to standard output: the n-th term of the sequence.

## sample
5
3