

def is_magic_series(xs):
    counts = {i: 0 for i in range(0, 10)}
    for x in xs:
        counts[x] += 1
    for i, x in enumerate(xs):
        if not x == counts[i]:
            return False
    return True


def get_max_series(length):

    def to_list(n):
        r = list(map(int, str(n)))
        return [0] * (length - len(r)) + r

    cs = [to_list(i)
          for i in range(0, 10 ** length)
          if is_magic_series(to_list(i))]

    return cs


if __name__ == "__main__":
    print(get_max_series(5))
