Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/uchliklar-soni

Triples with sum n

Medium 1000 ms 64 MB 48%
Share

A positive integer $n$ is given. How many triples of positive integers $(a, b, c)$ satisfy $a + b + c = n$ and $1 \le a \le b \le c$?

All triples for n = 7: 1+1+5, 1+2+4, 1+3+3, 2+2+3 shown as segments

Input

One positive integer $n$.

Output

One integer — the number of triples.

Note

$1 \le n \le 1000$

Examples

Input #1
7
Output #1
4
Input #2
3
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.