~/algor $ cat problems/kopburchak-diagonallari
Diagonals of a polygon
Easy
1000 ms
64 MB
9%
The number of vertices $n$ of a convex polygon is given. Find the number of its diagonals $D$. A diagonal is a segment joining two non-adjacent vertices:
$$D = \frac{n * (n - 3)}{2}$$
Input
One positive integer $n$.
Output
One integer — $D$.
Note
$3 \le n \le 10^{6}$
Examples
Input #1
5
Output #1
5
Input #2
4
Output #2
2