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