object Main{
  def main(args: Array[String]){
    while(true){
    val in = new java.util.Scanner(System.in)
    var num = in.nextInt
    var count = 0

    if(num > 0){
      var arr = new Array[Int](num+1)

      arr(0) = 0
      arr(1) = 0
      for(i <- 0 to num-1){
        arr(i) = 1
      }

      for(i <- 2 to num-1){
        if(arr(i) == 1){
          for(j <- 2 to num-1){
            if(i * j <= num){
              arr(i * j) = 0
            }
          }
        }
      }

      for(i <- 2 to num-1){
        if(arr(i) == 1){
          count = count + 1
          //println(i)
        }
      }
    }

    println(count)
    }
  }
}