import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer

object Main {
  val MaxNumber = 999999

  def main(args: Array[String]): Unit = {
    @tailrec
    def _eratos(_primes: ListBuffer[Int], _numbers: Array[Byte], prime: Int): Unit = {

      prime +=: _primes
      _numbers.update(prime, 1)

      var i = 0
      _numbers.foreach { delFlg =>
        if (delFlg == 0 && (i % prime == 0)) _numbers.update(i, 1)
        i += 1
      }

      if (prime < Math.sqrt(MaxNumber)) {
        val nextPrime = _numbers.indexOf(0, prime + 1)
        _eratos(_primes, _numbers, nextPrime)
      } else {
        i = 0
        _numbers.foreach { delFlg =>
          if (delFlg == 0) i +=: _primes
          i += 1
        }
      }
    }

    val numbers = Array.fill[Byte](MaxNumber + 1)(0)
    numbers.update(0, 1)
    numbers.update(1, 1)

    val primes = ListBuffer[Int]()
    _eratos(primes, numbers, 2)

    val sc = new java.util.Scanner(System.in)
    while(sc.hasNextInt) {
      val input = sc.nextInt
      println(primes.count(_ <= input))
    }
  }
}