# Arup Guha
# 12/9/2025
# Solution to 2025 UCF HS Online D2 Problem I: Welcome!

# Get the input.
n = int(input())

# The n-1 Triangle number.
print( ((n-1)*n)//2 )

# Did you see that the exact same code that solves B solves I???
# Ha ha, very funny!!!
