$prime = {}
$pas = {}
$pas[2] = 1
$pas[3] = 2
def prime_array_size(max)
  if max < 2
    ans = 0
  else
    while max > 3
      break if is_prime(max)
      max -= 1
    end
    unless $pas[max]
      i, ans = $pas.sort[-1]
      while i <= max
        if is_prime(i) then
          $pas[i] = ans
          ans += 1
        end
        i += 2
      end
    end
    return $pas[max]
  end
end

def is_prime(n)
  return true if $prime[n]
  if n < 2
    return false
  elsif n < 4
    $prime[n] = 1
    return true
  elsif n % 2 == 0
    return false
  else
    i = 3
    while i <= Math.sqrt(n)
      return false if n % i == 0
      i += 2
    end
    return true
  end
end

while n = gets
  puts prime_array_size(n.to_i)
end