BZOJ4665 小 w 的喜糖

We need to calculate number of permutations such that: $\(\forall i, A_{\pi_i} \neq A_i\)$