#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int MOD = 1000000007; typedef unsigned long long ull; int main() { int N; cin >> N; ull result = 0ull; for (ull i = 0; i < N; ++i) { result += i; } cout << result << endl; }