On a standard 8 \times 8 chessboard, it is possible to arrange queens such that none can attack another. Your task is to extend this concept to a chessboard of size n \times n and determine how many ways you can place queens so that no two queens threaten each other.
The input consists of a single natural number , where does not exceed .
The output should be a single integer representing the number of distinct arrangements of queens on an n \times n chessboard where no two queens can attack each other.
Example 1