For most cruise ships, the short answer is 4 people. 4 people is usually the maximum number of people allowed in a cabin and these are known as "Quad Cabins". These cabins are a sensible choice due to lowering the cost for each person. Usually these cabins have 2 twin beds setup in the room and 2 extra beds are available to be folded down from the wall. If you are booking a Suite cabin, usually the 3rd and 4th person can be accommodated within a fold out sofa bed. This allows everyone to be comfortable with their sleeping arrangements and ensures the cabin is neat and tidy during the day.
So I guess it's first in best dressed, to see who reserves the best bed!