s = oct(int(input(), 16))[2:] c = [s.count(i) for i in "01234567"] m = max(c) for i in range(len(c)): if c[i] == m: print(i, end=" ") print()