function Main(input) {
  input = input.replace(/\n/g, ' ');
  input = input.split(" ");
  var A = input[0];
  var ans = 0;
  for(var i=0;i<A;i++){
    ans+=i;
  }
  console.log(ans);

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));