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