#include #include int main() { std::string str; std::cin >> str; int n = std::stoi(str); int accumulator = 0; for (int i = 1; i < n; i++) { accumulator += i; } std::cout << accumulator << std::endl; }