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.
The rule of thumb is one nest box for every 4 hens. I have 4 nest boxes and 14 hens and they still fight over their favorites. Today is one of those days when all my girls are wanting to lay at the same time. There's some loud complaining coming from the coop as the girls wait, not so patiently, for their turn.