Given an integer ( N ), you are to choose a permutation ( {P_1, P_2, ..., P_N} ) of the integers ( {1, 2, ..., N} ). For each ( i = 1, 2, \ldots, N ), let ( M_i ) be the remainder when ( i ) is divided by ( P_i ). The task is to find the maximum possible value of the sum ( M_1 + M_2 + \cdots + M_N ).
Input Format
A single integer ( N ) (1 ≤ ( N ) ≤ 1000), representing the size of the permutation.
Output Format
A single integer, representing the maximum possible value of ( M_1 + M_2 + \cdots + M_N ).
Examples
Example 1
Input:
text
3
Output:
text
3
Example 2
Input:
text
5
Output:
text
8
Solution
You should implement your solution in the /app/ directory. Make sure your code follows the necessary standards for function definitions and that it handles the input and output as specified.
Important: place your implementation at /app/solution.py so the verifier can run it.