#include<stdio.h>
int main() {
    int n;
    long long result = 0;
    scanf("%d",n);
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    for(int i = 1; i<= n; i++){
        // to find the factorial
        long long fact = 1;
        for(int j = 1; j<= i; j++){
            fact = fact * j;
        }
        // add or sub
        if(i % 2 == 1){
            result = result + fact;
        }
        else {
            result = result - fact;
        }
    }
    print("%lld",result);
}