5 shots in most situations should be sufficient. In the case mentioned, 3 muggers possibly armed, it would probably be enough as by the time you have shot the second one down, the third guy is usually running away. In most cases just pulling the gun is sufficient. It not shooting the first one usually breaks their confidence.
However, for the sake of argument, if each one of the 3 is intent upon killing you, and has the intestinal fortitude to stand and fire no matter what, then you are facing 3 assassins, not muggers, and no matter what gun you have you are in serious trouble, unless you are very quick and very accurate with your gun. For those who fear that situation or who may be in it, they should by all means, carry a weapon with greater firepower, and possibly a back-up weapon, and possibly a bullet-proof vest.