from decimal import Decimal

n = int(eval(input()))

ans = int((n / Decimal(2)) * (n - 1))

print(ans)
n = int(eval(input()))

ans = int(n * (n - 1) // 2)

print(ans)

from decimal import Decimal

n = int(eval(input()))
ans = int((n / Decimal(2)) * (n - 1))
print(ans)

n = int(eval(input()))
ans = int(n * (n - 1) // 2)
print(ans)

-from decimal import Decimal - -ans = int((n / Decimal(2)) * (n - 1)) +ans = int(n * (n - 1) // 2)