while(input = ~~readline()) {
  let count = 0;
  for(let i=7;i<=input;i++) {
    if(i % 7 === 0 || /7/.test(`${i}`)) count++
  }
  console.log(count);
}