If you state the question "how many" the answer is in your question - enough to deal with workload without cutting the quality level. Then you should plan for some project risks - whether team size can be fixed or you expect changes in scope and client requesting your rapid reaction, etc.
However if you build a team it's even more important to decide who exactly has to be in the team in terms of skills, roles and characters.
One of things which is crucial while deciding about team size are skills. It is said that best developers can be 10 time more productive than others and even if the rate is disputable no one would reject the fact you can have one specialist who deals with twice as much work than another. If you just count heads you won't take all of that into your consideration which can sink the project.
Also you definitely should cover all the roles needed in project. It's hard to have comprehensive list of them since they would differ among projects and teams, but project management, analysis, design, development, testing, deployment, maintenance and support should be considered in this way or another. It doesn't mean you need a specialist in each role, but you should at least have a plan which team member will be dealing with what. It may require adding some people part-time to the project for a sole fact no one from the core team has enough experience and/or potential to fulfill a specific role.
Another story are people characters. There's a good question here about the way you select team which can help you with this one. Building the team out of rock star programmers only, even if they are highly productive, isn't the best idea I've heard. The team should be balanced if it means choosing people who aren't top performers.