#include<bits/stdc++.h> using namespace std; int main(){ int n,k;cin>>n>>k; cout<<(n-1)*(n-2)/2<<endl; return 0; }