function Main(input){
var N = input.trim();
N = parseInt(N,10);
var values = 0;
values = BigInt(N)*BigInt(N-1)/2;
BigInt(values) -= 1;
console.log(values);
}
  Main(require('fs').readFileSync('/dev/stdin','utf8'));