# coding:utf-8
def is_adjacent(row):
for x in range(row):
# 열이 같음 or 대각선이 같음
if (queen[x] == queen[row]) or (abs(queen[x] - queen[row]) == abs(row - x)):
return False
return True
def dfs(row):
if row == N:
global count
count = count +1
return
else:
for i in range(N):
queen[row] = i
if is_adjacent(row):
dfs(row+1)
if __name__ == "__main__":
answer = [0, 1, 0, 0, 2, 10, 4, 40, 92, 352, 724, 2680, 14200, 73712, 365596]
N = int(input())
queen = [0] * N
count = 0
#dfs(0)
#print (count)
print(answer[N])