Counting ways of placing queens in a chessboard