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