def count_fq(zz):
    """ x is a sorted list with repeats. returns a list of [count,value]
    where count is the number of times value is repeated in the list"""
    res = []
    s = 0
    z = list(zz)
    z.append(-100000)
    for i in range(len(z)-1):
        if not z[i] == z[i+1]:
            v = [s+1,z[i]]
            res.append(v)
            s = 0
        else:
            s=s+1
    return res