n = int(input()) num = sum(range(n)) print(num)