How many injective functions from $\{5,6,7,8,9\}$ to itself map $5$ to any number other than $5$ and $6$ to any other number than $6$?
Let $B=\{5,6,7,8,9\}, f:B\to B$.
I think we can solve this by inverting the problem, that is counting the number of injective functions where $5$ maps to $5$ and $6$ maps to $6$.
First there're $5!$ injective functions without restrictions. There're $4!$ functions where either $5\to 5$ or $6\to 6$ so there're $2\cdot 4!$ such functions in total. Lastly, there're $3!$ functions where both $5\to 5$ and $6\to 6$.
Therefore with restrictions the number of functions is: $$ 5! - 2\cdot 4! + 3! $$
I'm not sure whether I'm using the inclusion/exclusion principle correctly here.
Your answer $$ 5! - 2\cdot 4! + 3! = 78$$ is correct.
You have counted all the permutations and applied the inclusion exclusion principle correctly.