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

object Main {
  def sieve(n:Int) = {
    val primes = Array.tabulate(n+1) { _ % 2 }
    primes(1) = 0
    primes(2) = 1

    for{
      i <- 3 to Math.sqrt(n).toInt+1 by 2
      if primes(i) == 1
    }
      (i*i to n by i*2).foreach { primes(_) = 0 }

    primes
  }

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