Aztec Pyramid | 프로그래밍의 벗 PivotOJ
PivotOJ

Aztec Pyramid

시간 제한: 1000ms메모리 제한: 128MB출처: NEERC Northern Subregional 2012BOJ 7770
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

Aztec emperor Cuitláhuac is going to build a pyramid in his honor. This pyramid should be taller than previous ones.

The Aztec pyramid is build out of stone blocks. Each block is 1×1×1-hunab cube. Cuitláhuac places first block on the ground during the foundation ceremony. Each of the following blocks must share a face with at least one of the previous blocks.

[이미지 1]

The block is stable if it stands on the ground, or it stands on another block, that has a block or the ground next to each face. To stand the test of time the pyramid must be stable i.e. each block of it must be stable.

[이미지 2]

Cuitláhuac asks you to determine the height of the tallest stable pyramid that can be built out of available blocks.

입력

The only line of the input file contains a single integer number n — the number of available blocks, including the first one (1 ≤ n ≤ 109).

출력

Output the height of the tallest stable pyramid that may be built out of n blocks. The height must be output in hunabs.

예제

예제 1

입력
6
출력
2

예제 2

입력
5
출력
1

예제 3

입력
20
출력
3
코드를 제출하려면 로그인하세요.