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