N = input() x = 0 for i in range(1,N): x += i print(x)