P2158 [SDOI2008] Honor Guard

Description

As the sports committee member, Mr. C is responsible for training the honor guard for this sports meet. The honor guard is an $N \times N$ square formation of students. To ensure the formation marches in perfect order, Mr. C follows at the back-left of the formation and judges whether it is neat based on the number of students visible to him (as shown in the figure). ![](https://cdn.luogu.com.cn/upload/pic/1149.png) Now, Mr. C wants you to tell him the number of students he can see when the formation is neat.

Input Format

One line with a positive integer $N$.

Output Format

Output one line with a single number: the number of students Mr. C should see.

Explanation/Hint

Constraints: For $100\%$ of the testdata, $1 \le N \le 40000$. Translated by ChatGPT 5