Each element of set $B$ must be mapped to at least one element of set $A$, and we need to count how many such functions are possible.
We have 6 elements in set $A$ and 3 elements in set $B$. The condition is that each element in $B$ must have at least one pre-image in $A$, so we are looking for surjections (onto functions).
The total number of surjections from a set of size 6 to a set of size 3 can be calculated using the inclusion-exclusion principle.
The number of surjections from a set of size 6 to a set of size 3 is given by:
$3^6 - \binom{3}{1} 2^6 + \binom{3}{2} 1^6 = 729 - 192 + 3 = 540$
Thus, the total number of such functions is 540.