There are several ways to look at it, depending on what you see as the "benefit" that you should pay for:
1. Benefit = staying in the house for a day
You get the 27 person-days calculation by StewartFisher.
2. Benefit = having 1/nth of the house for yourself
This means that the days when there are 5 people are cheaper, because you share the cost of 1 days rent between the 5 of you (but you also get less "house" for your money). This is what tristancliffe calculated.
If the house can comfortably accommodate 5 people, then I'd say method 1 is fairest. But if the place gets crowded when the whole gang is there, use method 2.
And there is also another method:
3. Haggling
The guy who booked the house tries to extort as much money from his pals as possible. His friends wish him luck staying there on his own, and go to the pub.