#include<bits/stdc++.h> using namespace std; int main(){ int x = 1; int a; cin >>a; for(int i=1; i<=a-2; i++){ x = x+i; } cout <<x; return 0; }