n=gets.to_i d=[q=[u=1],1] [u+s=("%b"%u).count(?1),u-s].map{|v|d[v]||0