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

  object Primes {

    def isPrime(n: Int): Boolean = {
      n match {
        case 2 | 3 => true
        case _ => !(2 to n).takeWhile(p => p * p <= n).exists(n % _ == 0)
      }
    }

    def apply(n: Int): Seq[Int] = {
      2 +: (3 to n by 2).filter(isPrime)
    }

  }

}