sorts classes by number of entities