x = int(input()) sum1 = 0 for i in range(x): sum1 += i print(sum1)