// 完全数只有这几个
let arr = [6, 28, 496, 8128, 33550336]
let str
while(str = readline()){
let result = 0
arr.forEach(el => {
if(el <= parseInt(str)){
result++
}
})
console.log(result)
}
// 完全数只有这几个
let arr = [6, 28, 496, 8128, 33550336]
let str
while(str = readline()){
let result = 0
arr.forEach(el => {
if(el <= parseInt(str)){
result++
}
})
console.log(result)
}