In graph theory, an exercise tasks me with counting the amount of 1-factors (or perfect matchings) in the following graph: take $K_{n,n}$ with vertex sets $\{a_1,\dots, a_n\}\cup\{b_1,\dots, b_n\}$ and remove every edge of the form $a_ib_i$. Let's call this graph $\tilde{K}_{n,n}$. The exercise comes with a hint: "count the 1-factors in $K_{n,n}$ and exclude those which map some $a_i$ with $b_j$". I did so, but I think I got it wrong:
Note that there's an equivalence between counting 1-factors in $K_{n,n}$ and counting bijective functions from $\{a_1,\dots,a_n\}$ to $\{b_1,\dots,b_n\}$, and this implies that there are $|S_n| = n!$ 1-factors in $K_{n,n}$.
Now, I'm having trouble doing the second part. My intuition says there are $(n-1)!$ 1-factors that are such that $a_i\mapsto b_j$, because counting them is the same as counting the amount of bijective functions from a set of $n-1$ elements to itself, but I'm missing something. (More precisely, because I know that the answer must be $(n-1)!$, I'm missing a $(n-1)$ factor in the counting, because $(n-1)! = n! - (n-1)!(n-1)$. What does that $(n-1)$ mean?).
The number of bijections from $\{a_1,\ldots,a_n\}$ to $\{b_1,\ldots,b_n\}$ that map $a_i$ to $b_j$ is indeed $(n-1)!$.
If we want to phrase this number in the form $n!-\text{something}$, then we include all bijections, then exclude those that do not map $a_i$ to $b_j$. There are $n-1$ ways to choose what $a_i$ maps to (something other than $b_j$), and for each of these choices, there are $(n-1)!$ bijections which satisfy it.
So we get $$n!-(n-1)(n-1)!=(n-1)!$$ bijections that map $a_i$ to $b_j$ this way too.