Consider two sets A and B each with "n" elements. How many distinct surjective (onto) functions from A to B are possible?
Note that a surjective function from $A$ to $B$, both having the same cardinality is an injection. (Hence, a bijection).
The first element of $A$ has $n$ options for B.
The second element of $A$ has $n-1$ options, avoiding the selected element, otherwise, it will not be a surjection.
The $i$-th element has $n-(i-1)$ options.
Multiplying them up, we have $n!$ such choices.
you can also go through the first element of $B$ and let it choose its preimage. It has $n$ options.
Now choose the preimage for the second element of $B$, it can't choose the same element as the first as that would violate the definition of a function.
Repeat the argument and you will get $n!$.