It's based on highly sophisticated software which takes into account every possible factor about every flight. On one day, the "magic number" could be 2 and the same flight the next day could be 10. Because CO can always UG at the gate, there is a positive incentive to withold seats until the gate if there is any chance they can be sold (or used for misconnection paid F pax).