Classify objects into given categories; count the number of objects in each category and sort the categories by count.