#include<bits/stdc++.h> using namespace std; int main(){ int n,x=1; cin>>n; for(int i=0;i<=n-2;i++){ x=x+i; } cout<<x; return 0; }