from itertools import groupby
lst = ['a', 'c', 'f', 'r', 'a', 'a', 'f']
lst.sort()
result = {}
for k, g in groupby(lst):
result[k] = sum(1 for _ in g)
from collections import Counter
lst = ['a', 'c', 'f', 'r', 'a', 'a', 'f']
lst.sort() # не обязательно
result = Counter(lst)