N = int(input()) sum = 0 for i in range(N): sum = sum + i print(sum)