def METHOD_NAME(singletons):
    uppers = [] # (upper, # items in lowers)
    lowers = []
    for i in singletons:
        upper = i >> 8
        lower = i & 0xff
        if len(uppers) == 0 or uppers[-1][0] != upper:
            uppers.append((upper, 1))
        else:
            upper, count = uppers[-1]
            uppers[-1] = upper, count + 1
        lowers.append(lower)
    return uppers, lowers