#include using namespace std; using ll = long long; int main(void){ ll n;cin >> n; cout << n * (n - 1) / 2 << '¥n'; return 0; }