递推DP
//MADE BY Y_is_sunshine;
//#include <bits/stdc++.h>
//#include <memory.h>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <math.h>
#define INF 0x3f3f3f3f
#define MAXN 105
const int mod = 1e9 + 7;
using namespace std;
long long d[25];
int main()
{
freopen("data.txt", "r", stdin);
d[2] = 1;
d[3] = 2;
for (int i = 4; i <= 20; i++)
d[i] = (i - 1) * (d[i - 1] + d[i - 2]);
int N;
while (cin >> N)
cout << d[N] << endl;
freopen("CON", "r", stdin);
system("pause");
return 0;
}