Let n be the number we don't know.
Three times this number can be express as:

The sentence "When 8 is subtracted from three times a number" can be express (using the expression we found before) as:

Finally we know that this is equal to 4, then we have the equation:

Solving for n we have:

Therefore the number we are looking for is 4.