let line=parseInt(readline());
let num=0;
for(let i=1;i<=line;i++){
    if(i%7===0){
        num++
    }else if(i.toString().includes('7')){
        num++
    }
}
console.log(num)