Place n queens on an n × n chessboard so that no two queens attack each other (same row, column or diagonal). Count the distinct solutions.
Input: one integer n (1 ≤ n ≤ 9). Output: the number of solutions.
Your program reads from stdin and prints to stdout.
Example 1
Input: 1
Output: 1
Hints