#include <bits/stdc++.h>
using namespace std;
#define max(x, y) x >= y ? x : y
#define min(x, y) x <= y ? x : y
#define INF 0x3f3f3f3f
bool m[11][11];
int n;
int ans;
//1 0 0 2 10 4 40 92 352 724
int Ans[11] = {0, 1 ,0 ,0 ,2 ,10 ,4 ,40 ,92 ,352 ,724};
bool judge(int x, int y)
{
/*行列无法摆放*/
for (int i = 0; i < n; i++) {
if (m[i][y]) return false;
if (m[x][i]) return false;
}
/*斜侧都不能摆放*/
int xx, yy;
xx = x - 1;
yy = y - 1;
while (xx >= 0 && yy >= 0) {
if (m[xx][yy]) return false;
xx--;
yy--;
}
xx = x - 1;
yy = y + 1;
while (xx >= 0 && yy < n) {
if (m[xx][yy]) return false;
xx--;
yy++;
}
return true;
}
void dfs(int x, int y, int index)
{
//cout << "(" << x << "," << y << ") : " << index << endl;
m[x][y] = true;
if (index == n) {
ans++;
m[x][y] = false;
//system("pause");
return ;
}
int xx, yy;
xx = x + 1;
if (xx < n) {
for (yy = 0; yy < n; yy++) {
if (judge(xx, yy)) dfs(xx, yy, index + 1);
}
}
m[x][y] = false;
}
int main()
{
ios::sync_with_stdio(false);
while (cin >> n && n) {
//ans = 0;
//memset(m, false, sizeof(m));
//for (int j = 0; j < n; j++) {
// dfs(0, j, 1);
//}
//cout << ans << endl;
cout << Ans[n] << endl;
}
return 0;
}