Suppose I have two identical sets of a certain size, e.g. $A=\{1,2,3\}$ and $B=\{1,2,3\}$.
I want to assign each element of $A$ to an element of $B$. Each element of $B$ can only be assigned once. Also: It is not allowed that an element of $A$ gets assigned to itself in $B$. I'm trying to calculate how many solutions exist given the size of the set.
In the above example there would be 2 solutions: $(1,2)$ $(2,3)$ $(3,1)$ and $(1,3)$ $(2,1)$ $(3,2)$