N=format(int(input(),16),'o') L=[0]*8 for n in N: L[int(n)]+=1 ANS=[] for i in range(8): if L[i]==max(L): ANS.append(i) print(*ANS,sep=" ")