This is the default behaviour of the product. I don't know why Microsoft decided this because is odd. If you Leave the communnity still presents the same number.
I have already written to Microsoft so that they check it but it seems to be the desired behaviour because the community stores your historical data (badges, discussions, etc) and never will be removed
I want to show you a code to get the members of a community that are already joined.
SPWeb web = SPContext.Current.Web;
SPList Members = web.Lists.TryGetList("Community Members"));
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name="MemberStatusInt"/><Value Type="Integer">1</Value></Eq></Where>";
SPListItemCollection colection = Members.GetItems(query);
int membersJoined = colection.Count
The field MemberStatusId indicates if the member "belongs" or not to the community. If the value is 2 the member ever left the community.
Actually, when you leave the community the field MemberStatusId is set to 2 and ReputationScore is set to -1
Create a WebPart with a label indicating the "real" members of the community using the code provided. Good Luck