How many smoke detectors are required in a house?

Smoke detectors, powered by the building's electrical system, and interconnected each to the others, are required in all sleeping rooms and in the immediate vicinity outside each sleeping area, and on each additional story of the dwelling unit, including the basement.