Not trying to be a bold contrarian here, but both of the above responses DON'T answer the actual question, but answer a similar - yet different - question that was NOT asked "How many credit cards should you use and why?"
If everyone accepts one of two cards, why have more? What if one of two cards is lost, suffers ID theft, has the limits slashed, or you hit a hard-patch and have your limit reduced or canceled? Now 50% of your open accounts are gone - POOF! - or damaged. God forbid you have problems with a lost or stolen purse or wallet and BOTH of the "only two cards you'll ever need" are maxed out by some con man... Sure you can sort though it... And you will have limited liability... But in the mean time? If and when your CC issuer terminates that account number, and issues you a new card, you now suffer the insult of having these new account numbers showing up at the CRAs like NEW accounts, wiping out the "average age of account" you built up with the "only two you'll ever need". Just watch the points melt right off the credit score...
I have three credit cards that I have used exactly once each before I fed them to the super-duty industrial strength paper shredder at the office. I carried a balance for one month on all of them to (1) leave a history of them HAVING HAD a balance, (2) the intro APRs were either "0" or single digit... And then they were lunch for the office paper shredder. I send $1.00 each (via bill pay) to each of them every other month. Why? On credit reports in the profile of each credit line it notes when the last payment or transaction was made. Additionally, these three "phantom accounts" not only add age, good payment history, and diversity to my credit report, they also serve to add some sparkle to my "balance-to-limit" ratio. Two of them have raised my limit several times. This boosts my score because when I do carry a balance, the ratio of my balances to total available credit is more favorable still.
The day may also come when the two cards I am using regularly now fall out of favor with me, or I fall out of grace with them, or - heck - the bank goes belly up... Now I have some options also.
You may only want to USE two, but I think having ONLY two can be a little dangerous also.
To answer the question asked "So what is the "ideal" number of credit cards to have as far as your credit score is concerned?"
A mix of credit types - loans & credit/charge cards - can be very positive, even if the open accounts are ones you do not use, or even if the installment loans are "savings secured". Each account type - when paid on time - adds one more positive mark to your credit history. At the same time, this has to be weighed against what your total "debt-to-income" and "balance-to-limit" ratios are. It won't impress anyone - or do you much good for your score - to have 20 credit cards that you have just about maxed out that you pay the minimum payment on (on time) either.
Ultimately there is no magic number. 10+ years ago I had a wallet full of store and credit cards (14) that I used regularly, paid on time, and got credit-limit increases on regularly. In a fit of anxiety brought on by watching my own parents' financial meltdown, with all the cards in good standing or paid off, I wrote to all of them to close my account, mark it as "closed per consumer request" and cut all but three up. If I had to do it all over again, I would simply have tossed them all in the paper-shredder, paid them off, and left them linger in limbo - open but not being used. The difference it would have made in my credit score for the better today!
Is there a point or "magic number" at which there are too few credit card accounts to establish a person's credit, and the other extreme in which a person has so many credit cards that they actually see their credit score go down?