Let $S = \{1,2,3,4\}$. Let $F$ be sets of all functions from $S$ to $S$.
How many $f\in F$ are there so that $(f \circ f)(1) = 2$ ?
How I see it, is through a diagram and so that there is $4*4*4*4$ ways for the first $f$ to make all of it's outputs and then there is $4$ to connect these outputs to $2$ because either $1$ or $2$ or $3$ or $4$ arrows must connect to $2$.
So $4^4*4$ is the answer?
Juan Diego Rojas' answer preceded mine.
I agree with Juan Diego Rojas' reasoning. Since the OP asked for a count of the number of functions, I will piggyback off of Juan's reasoning.
If f(1) = 2, then f(2) must = 2. There are $4^2$ functions that will do this (i.e. f(3) can be anything and f(4) can be anything).
If f(1) = 3, then f(3) must = 2. Again there are $4^2$ functions.
If f(1) = 4, then f(4) must = 2. Again there are $4^2$ functions.
So the total number of satisfying functions is $3\times 4^2 = 48.$