My initial methods of building characters involved looking inside myself. I based my protagonists off my own traits, or who I wanted to be. I'm admitting this as a starting point, not as advice, because readers can smell an authorial self-insert a mile off, whether they know you or not.
When I realized that my own traits couldn't make for a full-fleshed-out world, I began looking at others, at their inherent contradictions and values. I started to see that, while I didn't always agree with some people, their ways of arriving at values and conclusions were sound and followed some interesting internal logic. I took note of their various complexities, and started writing characters with similar issues. Or, I learned about people's backgrounds, and imagined how they'd be different if some detail were changed along the way.
I also looked at the characters I liked in the books I was reading. If I couldn't get into someone's motivation, I'd make something up, and see what changed in the narrative as a result of this insight. I tweaked backgrounds, stole traits, lifted flaws wholesale out of some stories.
That wasn't the end of the process, though. While I may have been able to write some of the most faceted characters in modern literature, I had to give them the right story, and the right world to inhabit. My character with trust issues wouldn't work out in a world populated with open and honest souls, and my oh-so-superior protagonist would be boring in a world where there aren't things that are more powerful than she is. The characters' flaws and backgrounds had to be not only believable, but also relevant to the story.
If you can't come up with a motivation and background for the guy who hands your protagonist her coffee in chapter five, don't worry. You don't have to name every single person the protagonist runs into, only the ones the perspective character thinks are important. But you will want more named characters than just your protagonist, a small circle of allies, and the antagonist. I can't give you a solid number, because that depends on the story you're trying to tell.