Most people would recommend 4 but you can probably get away with 3, especially if they are a little large so 2 could get in and lay at the same time. You'll find they prefer 1 or 2 anyway. Some of the risks with a smaller number of nesting boxes is that the hens will try to lay on top of each other, which could cause an occasional broken egg. If all nesting boxes are full of hens laying, another hen that is ready may find another place to lay an egg. Maybe someone will come up with another reason for more nesting boxes.
It is usually not a good idea to put the nesting boxes in until they are ready to lay. They may get used to roosting in the nests or just going in and hanging out, thus pooping in the nests.