you need to have at least one box per cat, and most people recommend one more. Also, if one cat got mad and peed somewhere, and you didn't get the smell out all the way, the other cats will think its ok to go there, even if they don't have behavioral issues. This means getting down to the pad of the carpet, even to whatever is underneath, and getting the smell out.
I have 7 cats. Oscar has been battling for alpha cat position, and losing, since he showed up as a stray in July. He started peeing about a month ago. He was checked for UTI, he's clean, so we have chaked it up to behavioral. He is now on amitriptyline, which is an anti depressant. You should take your cats to the vet and first have them all checked for a UTI. Then try different things, like Feliway diffusers, Cat Attract litter (works wonders). Then discuss drugs. Oscars amitriptyline is a human drug that is on the $4 generics list. So for a whole year it will only cost me about $50. Not too bad, considering I don't have to crawl around on the floor with a blacklight anymore looking for spots he's peed on.