#abc139d. [abc139_d]ModSum

[abc139_d]ModSum

Problem Statement

For an integer NN, we will choose a permutation P1,P2,...,PN\\{P_1, P_2, ..., P_N\\} of 1,2,...,N\\{1, 2, ..., N\\}.

Then, for each i=1,2,...,Ni=1,2,...,N, let MiM_i be the remainder when ii is divided by PiP_i.

Find the maximum possible value of M1+M2+cdots+MNM_1 + M_2 + \\cdots + M_N.

Constraints

  • NN is an integer satisfying 1leqNleq1091 \\leq N \\leq 10^9.

Input

Input is given from Standard Input in the following format:

NN

Output

Print the maximum possible value of M1+M2+cdots+MNM_1 + M_2 + \\cdots + M_N.


Sample Input 1

2

Sample Output 1

1

When the permutation P1,P2=2,1\\{P_1, P_2\\} = \\{2, 1\\} is chosen, M1+M2=1+0=1M_1 + M_2 = 1 + 0 = 1.


Sample Input 2

13

Sample Output 2

78

Sample Input 3

1

Sample Output 3

0