import scala.util.control.Exception._
import scala.io.StdIn.readInt
import java.io.EOFException

object Main {
    def sieve(num:Int) = {
        var p:Array[Int] = Array.fill(num+1)(1)

        p(0) = 0
        p(1) = 0
        for( i<- 4 to num by 2)
            p(i) = 0

        var i = 3
        while(i*i < num){
            if(p(i) == 1) {
                for( j<- i*i to num by i*2)
                    p(j) = 0
            }
            i += 2
        }
        for(i<-1 to num)
            p(i) = p(i)+p(i-1)
        p
    }

    def main(args: Array[String]) = {
        val p = sieve(1000000)
        ignoring(classOf[EOFException]) {
            while(true) {
                val n = readInt()
                println(p(n))
            }
        }
    }
}