#include using namespace std; int main () { int N,ans; cin >> N; for (int n = 0;n < N;n ++) { ans = ans + n; } cout << ans ; return 0; }