시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 0 0 0 0.000%

문제

Andrew started playing a new multiplayer online game. He needs to create a flag to be different from other players.

Andrew decided that there should be $n$ stars on the flag forming a figure just like on the US one:

  • The stars should be arranged in horizontal rows, placed one below the other.
  • The difference of number of stars in any two rows must not be greater than one.
  • If there are two rows with different number of stars, then the number of stars in any two adjacent rows must be different.

Andrew doesn't want the flag to be too long or too wide, so he is interested in the minimum possible absolute difference of the number of rows and the maximum number of stars in a row.

입력

The only line of input contains an integer $n$ --- the number of stars ($1 \le n \le 10^{12}$).

출력

Output a single integer --- the minimum possible absolute difference of the number of rows and the maximum number of stars in a row.

예제 입력 1

1

예제 출력 1

0

예제 입력 2

2

예제 출력 2

1

예제 입력 3

3

예제 출력 3

0

예제 입력 4

50

예제 출력 4

3

힌트

An example of the optimal arrangement of the stars in the fourth test case: