import scala.io.StdIn._
import scala.annotation.tailrec

object Main {

  def prime(x:Int,list:List[Int]):Boolean = list.filter(y => x % y == 0 && x>y).size == 0

  @tailrec
  def loop(s: String){
    if(s != null){
       val Array(n,_*) = s.split(" ").map(_.toInt)
       val list = List(2,3,5) ::: (6 to math.sqrt(n).toInt).toList.filter(x => x%2!=0 && x%3!=0 && x%5!=0)
       println(((math.sqrt(n).toInt-1 max 2) to n).toList.filter(prime(_,list)).size)
       loop(readLine)
    }
  }

  def main(args: Array[String]): Unit ={
    loop(readLine)
  }
}