Count the number of distinct ways to place n queens on an n × n chessboard so that no two attack each other (no shared row, column, or diagonal).
Input: one line, the integer n.
Output: the number of solutions.
4
2
1
1
Run your code against the sample tests, or Submit to run the full suite.