• + 0 comments
    from collections import OrderedDict
    
    n = int(input())
    count = 0
    inp_dict = OrderedDict()
    
    for i in range(n):
        word = str(input())
        
        if word in inp_dict:
           inp_dict[word] += 1
        else:
            inp_dict[word] = 1
            count +=1
            
    print(count)
    print(*(inp_dict[word] for word in inp_dict))