I used the principle of inclusion-exclusion for solving this. I want to know if my solution is correct. The answer for the problem will be given by:
$Total\;into\;functions - Functions\; with\; 1 \;incorrect\; match + Functions \;with\; 2\; incorrect\; matches - Functions \;with \;3 \;incorrect\;matches + Functions \;with \;4\; incorrect\; matches$
Answer $= \binom{6}{4}4! - \binom{4}{1}5*4*3 + \binom{4}{2}4*3 - \binom{4}{3}3 + \binom{4}{4}$
Answer $ = 360 - 240 + 72 - 12 + 1 = 181$