Calculated the number of events per category