# Arup Guha
# 12/9/2025
# Solution to 2025 UCF HS Online D1 Problem A/D2 Problem B: Bunny

# Get the input.
n = int(input())

# The n-1 Triangle number.
print( ((n-1)*n)//2 )

'''
Let's try to work out f(n)...first do n=3, n=4:

f(3) = 1/2 x 1 + 1/2 x (2 + f(3) )

The idea here is that 1/2 the time you make it.
The other half the time you jump 1 then jump 1 back and
you are back to the beginning. So the two terms above
encapsulate that expectation via the expectation formula.

Solve for f(3)

f(3)/2 = 1/2 + 2/2 so f(3) = 1 + 2

Setting up the same equation for f(4) we get:

f(4) = 1/3 x 1 + 1/3 x (2 + f(4)) + 1/3 x (3 + f(4))

1/3 probability for jumping 3, 1 or 2. If you jump 3
you are done. If you jump 1, you jump 1 back and start over.
If you jump 2, you jump back twice and start over. Solving,

f(4)/3 = 1/3 + 2/3 + 3/3, more generally f(4)=1+2+3

We can set this generally up for f(n) and we'll get:

f(n)/(n-1) = 1/(n-1) + 2/(n-1) + ... + (n-1)/(n-1) or
f(n) = 1 + 2 + 3 + ... + (n-1), the n-1 triangle number.
'''
