module app;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

void main()
{
    Input input = parseInput();
    auto result = main2(input);
    writefln("%d", result);
}

BigInt main2(Input input)
{
    BigInt first = 1;
    BigInt last = input.n;
    return (first + last - 1) * (last - 1) / 2;
}

unittest
{
    Input input = {2};
    auto result = main2(input);
    assert(result == 1);
}
unittest
{
    Input input = {13};
    auto result = main2(input);
    assert(result == 78);
}
unittest
{
    Input input = {1};
    auto result = main2(input);
    assert(result == 0);
}

struct Input
{
	uint n;
}

Input parseInput()
{
	Input input;
	input.n = readln().strip().to!uint;
	return input;
}
