f(f(x)) = 5 = f(x')
If x' >= -4, then 5 = x'^2 - 4; x' = 3.
If x' < -4, then 5 = 3x' + 1; x' = 4/3.
Case 1: f(x) = 3
If x >= -4, then 3 = x^2 - 4; x = sqrt(7).
If x < -4, then 3 = 3x + 1; x = 2/3.
Case 2: f(x) = 4/3
If x >= -4, then 4/3 = x^2 - 4; x = 4sqrt(3)/3.
If x < -4, then 4/3 = 3x + 1; x = 1/9.
Thus there are 4 values of x that work, and the values are above.
There is a much quicker way to do it than calculating it; try looking at how many options there are for the range of x (in this case there are 2: x >= -4, x < -4) then multiply by the #of 'f's (in this case 2: f(f(x))). 2 x 2 = 4. :)