function Main(input) {
    var N = parseInt(input[0], 10);

    var max = (((N - 1) + 1) * ((N - 1) / 2));
    console.log(max);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));