From most accounts the number is near zero.  In vast majority of cases, presenting proof that the victim is capable and willing to use deadly force for self protection, the attacker will retreat.  Some accounts put the number when shots are actually fired in the neighborhood of 3 or 4.  In the cases, where the attacker is not willing to give up or in the case of multiple attackers, the number is many times in the 20 to 50 range.  Police officers typically carry 15-18 in their hand gun and two extra magazines.  Having more ammo than needed is very good.