def count_leading_values(lst, char):
    """count the number of char at the beginnig of the string/bytearray lst"""
    n = 0
    l = len(lst)
    while n < l and lst[n] == char:
        n += 1
    return n