In how many different ways can we place 8 identical rooks on a chess board? In how many different ways can we place 8 identical rooks on a chessboard so that no two of them attack each other and none of them is on main diagonal?
I have tried many ways to solve it and I am quite sure it should be done by few cases. But I can't come up with any idea.
 A: From the following example of a non-attacking rook placements it is possible to see that there is a bijection between non-attacking rook placements and permutations of the numbers $1$ to $8$. 
$$\begin{array}{cc}
& \text{Positions}\\
\begin{array}{c}\text{Numbers}\\\text{to be}\\\text{permuted}\end{array}&\begin{array}{c|c|c|c|c|c|c|c|c|}
& \mathbf{1} & \mathbf{2} & \mathbf{3} & \mathbf{4} & \mathbf{5} & \mathbf{6} & \mathbf{7} & \mathbf{8}\\
\hline 1& \bbox[silver,20px]{}& & & & & & &\Large\unicode{x265c}\\
\hline 2& &\bbox[silver,20px]{} & & & & &\Large\unicode{x265c} &\\
\hline 3& & &\bbox[silver,20px]{} & &\Large\unicode{x265c} & & &\\
\hline 4& &\Large\unicode{x265c} & &\bbox[silver,20px]{} & & & &\\
\hline 5& & & & &\bbox[silver,20px]{} &\Large\unicode{x265c} & &\\
\hline 6& & &\Large\unicode{x265c} & & &\bbox[silver,20px]{} & &\\
\hline 7& & & &\Large\unicode{x265c} & & &\bbox[silver,20px]{} &\\
\hline 8&\Large\unicode{x265c} & & & & & & &\bbox[silver,20px]{}\\
\hline\end{array}
\end{array}$$
This is the permutation
$$\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
8 & 4 & 6 & 7 & 3 & 5 & 2 & 1
\end{pmatrix}$$
The forbidden diagonal squares then correspond to permutations with fixed points. As the reader may be aware permutations that avoid fixed points are referred to in the literature as 'derangements' and there are many ways to approach calculating them. 
See here for how to derive the simplest formula for derangements using the nearest integer function: $[\:]$
$$!n=\left[\frac{n!}{e}\right]$$
giving
$$!8=\left[\frac{8!}{e}\right]=14\,833\tag{Answer}$$
Alternatively the problem can be easily solved using rook polynomials and for a quick way to see the solution input a diagonal forbidden subboard into an $8\times 8$ chessboard using this rook polynomial calculator. 
The benefit of the rook polynomial method is that it can be used for more complicated sets of restricted position permutation problem such as this one I answered recently.
