N=int(input()) res=0 for i in range(N): res+=i print(res)