f=[3,5,17,257,65537] a=[] n=gets.to_i while f[0] <= n a+=f f.map!{|e|e*2} end p a.uniq.sort.count{|x| x<= n}