Count the number of valid placements of n queens on nxn board.