/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0009
  * Prime Number
  */
object Main {
  def main(args: Array[String]): Unit = {
    Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).map(_.toInt)
      .map((n) => {
        sieveOfEratosthenes.takeWhile(_ <= n).length
      })
      .foreach(println)
  }

  def sieveOfEratosthenes: Stream[Int] = {
    def sieve(primes: Stream[Int], candidates: Stream[Int]): Stream[Int] = {
      if (candidates.isEmpty) primes
      else
        sieve(primes #::: Stream(candidates.head), candidates.tail.filter(_ % candidates.head != 0))
    }

    sieve(Stream.empty, Stream.from(2).takeWhile(_ <= 999999))
  }

}