Consider the sets $A:= \{1, 2, 3, 4\}$ and $B:= \{1,2,3\}$. It is not hard to count the number of surjections $A \to B$, namely $36$, by subtracting the number of non-surjections from $81$.
But I'm not sure where exactly the following naive approach goes wrong.
Pick one of the four elements of $A$ to be mapped to $1$. Then select one of the three remaining elements to be mapped to $2$. Then select one of the remaining two to be mapped to $3$. Then for the last element, select one of the three elements of $B$ to be its image. In total, we get $4*3*2*3 = 72$ surjections.
Could someone please point out the mistake in reasoning?