How many distinct functions $f : \{1, 2, 3, 4, 5 \} \to \{1, 2, 3 \}$ are there, from the set $\{1, 2, 3, 4, 5\}$ to the set $\{1, 2, 3\}$, whose range is a set of size exactly $2$?
I got $3^5$ total number of functions but don't know how to go further?