#include #define rep(i, a, n) for(int i = a; i < n; i++) #define repp(i, n) rep(i, 0, n) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long using namespace std; typedef pair P; signed main(){ int n; cin >> n; // while(n % 2 == 0){ // n /= 2; // } // cout << (n % 2 == 1 ? n : 1) << endl; cout << n * (n - 1) / 2 << endl; }