Candy counter problem