main=readLn>>=putStr.(show=<<).f f n=map snd$reverse$takeWhile((0,0)/=)$iterate g$g(n,0) g(n,_)=divMod n 2