Why are you counting them? Could you use a set instead?