#include <bits/stdc++.h>
using namespace std;
  
int main(){
    int n,i,j,f,s = 0,x;
    f = 1;
    cin>>n;
    for(i = 1;i <= n;i++){
        x = 1;
        for(j = 1;j <= i;j++){
            x = x * j;
        }
        s = s + f * x;
         
        f = f * -1;
    }
     
    cout<<s<<endl;
}
/**************************************************************
	Problem: 1518
	User: linzihang
	Language: C++
	Result: Accepted
	Time:12 ms
	Memory:2072 kb
****************************************************************/