info

MAPS OS v1.1.4 © 2025

Glory to the Segtree

Glory to the Algorithm.

Parsa Hates RectanglesGo home

Login to view input

no submission

Login to submit an answer

Problem Leaderboard

Problem Leaderboard

Parsa Hates Rectangles

After finishing his 1047 assignment, Parsa has developed a deep hatred for all rectangular shapes (thanks to his LCD being a rectangle). So, he decides to turn everything into triangles.

He starts with a stick of length n and wants to cut it twice into three smaller sticks of positive integer lengths. Then, he tries to form a triangle using those three pieces.

Now Parsa wonders, how many different triangles can he make by cutting the stick of length n into three positive integers that form a valid triangle?

Two triangles are considered different if the sets of side lengths are different (regardless of order).

Input Format:

The first line an integer n.

Output:

Output the number of different triangles.

Sample Input:

12

Sample Output:

3