added a function to sort schedule by how many classes for each class there are