Read the following passage and solve the questions based on it.
A large cube is painted on all its six faces. Now it is cut into a certain number of smaller identical cubes. It was found that among the smaller cubes, there were eight cubes which did not have any face painted.
How many small cubes have exactly three faces painted?