Counting and confusion: Bayesian rate estimation with multiple populations