I am trying to solve exercise 2.1 in Aluffi's textbook "Chapter 0":
How many different bijections are there between a set $S$ with $n$ elements and itself?
Here is my attempt. My "non-rigorous" answer is that I can make the function injective by choosing $n$ elements for where to make the first element of $S$, $n-1$ possibilities for the second, and so forth, giving $n!$ functions. Then this is a function injective function from $S$ to $S$ which is finite, so it is immediately surjective. (I don't think surjectivity just "follows" without invoking this kind of obvious, though it sounds obvious that it's surjective, though it's somewhat tough to prove.) Here is my attempt at making the argument rigorous, but I'd appreciate feedback on this above sketch as well.
Since there are $|n|$ choices for where to send each $s_i \in S$, there are exactly $n^n$ functions $f: S \to S$. If $f(s_1) = f(s_2)$ for $s_1 \neq s_2$, then $\mathrm{Im}(f) \not \subset S$, i.e., its cardinality is $< n$, so it is not surjective; furthermore, it is not injective. There are $n!$ mappings $S \to S$ with no repeated inputs or repeated outputs, which are the only bijections $S \to S$.
How does this look? Are there ways to make it more rigorous?