n=gets.to_i d={1=>1} q=[1] (u=q.shift h=u.to_s(2).count(?1) [u+h,u-h].map{|v| d[v]||0