import scala.collection.mutable
import scala.io.StdIn._

object Main
  extends App {
  def primeNumbers(stream: Stream[Int] = Stream.from(2)): Stream[Int] = stream match {
    case h #:: tail => h #:: primeNumbers(tail.filter(_ % h != 0))
  }

  def isPrime(n: Int): Boolean =
    if (n == 1) false
    else if (n == 2 || n == 3) true
    else (2 to math.sqrt(n).toInt).forall(n % _ != 0)

  val N = 1000000
  val primeNumbers: mutable.HashSet[Int] = (2 to N).to[mutable.HashSet]
  (2 to math.sqrt(N).toInt).foreach(n =>
    if (primeNumbers.contains(n)) Range(n * n, N, n).foreach(primeNumbers -= _)
  )

//  val primeNumbers = (2 to math.sqrt(N).toInt).foldLeft((2 to N).toSet)((acc, n) =>
//    if (acc.contains(n)) acc.diff(Range(n * n, N, n).toSet) else acc
//  )


  Stream
    .continually(readLine)
    .takeWhile(_ != null)
    .map(_.toInt)
//    .map(n => if (n == 1) 0 else primeNumbers().takeWhile(_ <= n).size)
//    .map(n => (1 to n).count(isPrime))
    .map(n => primeNumbers.count(_ <= n))
    .foreach(println)
}

