The Hertzsprung Problem goes as follows: In how many can we place exactly $n$ non-attacking kings on a $n \times n$ chessboard such that there is exactly $1$ king in each row and column where $n \in \mathbb{N}$.
My main question is: How did Flajolet and Sedgewick get the below generating function for the Hertzsprung problem?
$$\sum_{n=0}^\infty n! x^n \frac{(1-x)^n}{(1+x)^n}$$
Flajolet and Sedgewick discuss this generating function briefly and somewhat vaguely on page $373$ in Enumerative Combinatorics. They give a sketch of a sketch. However I'm totally not sure how they got the generating function. I have tried to extract the same generating function for a long time using restricted permutation, I mean the Hertzsprung problem reduces to finding number of permutations of $[n]$ such that no two adjacent digits in the permutation are consecutive.
Moreover using the restricted permutations argument we get a nice closed form as follows
$$n!+\sum_{k=1}^n {(-1)^k}(n-k)!\sum_{i=1}^k 2^{i} \binom{k-1}{i-1}\binom{n-k+1}{i}$$
by simply using Principle of inclusion-exclusion and stars and bars argument.
However I don't know how Flajolet and Sedgewick got the generating function
$$\sum_{n=0}^\infty n! x^n \frac{(1-x)^n}{(1+x)^n}$$
Any idea how to approach the problem for finding the generating function? I have already searched all the references in (oeis.org/A002464) but no reference gives a proof on how they got the generating function. All the references just show or give an approach on how to get the closed form of the double sum which is very easy to get.
Your help would be highly appreciated.
Thanks.