12082 - CS_2018_MID2-3   

Description

You have to place N queens on a NxN chessboard in such a way that no queen threatens another one.

The rule is that each row and column of the board contains exactly 1 queen , and each diagonal contains no more than 1 queen.

Your mission is to compute how many possible ways to place N queens on that chessboard.

Input

An integer N which represent the size of chessboard and the number of queens

where 1<=N<=50.

Output

An integer which represent the number of possible distributions of  N queens.

There is no need to add '\n' at the end of output

Sample Input  Download

Sample Output  Download

Tags




Discuss