A isomorphism between two sets is a way of associating precisely one element of the first set with precisely one element of the second set. These associations are embodied in the functions f\colon A\to B and g\colon B\to A, and the uniqueness of the associations is expressed by the conditio that g be simultaneously a section and a retraction of f. Two sets of different cardinality can not be associated in this way, because there would always be left over elements that are not associated to any corresponding element. In this way, we see that a isomorphism exists between two sets if and only if they have the same cardinality.
Assuming two finite sets A,B with cardinality \mathord {\#}{A}=\mathord {\#}{B}=n, we must now count precisely how many isomorphisms there are from A to B. To construct such a isomorphism, we put all the elements B into a pile. Then, for each element of A we must successively choose and then discard an element of B; we have to discard the element because we are not allowed to choose it again (for, if we did, the association would not be an isomorphism). At the beginning (“round k=0”), there are n many choices we could make; in the next round k=1, there are n-1 many choices that we could make; in the kth round, there are n-k many choices that we could make. At the very end (after the n-1th round), we shall have constructed a isomorphism after making n! = \prod _{0\leq k<n} n-k choices in total. Thus the number of distinct isomorphisms from A to B is n!.