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