$prime = []
def prime_array_size(max)
  ans = 1
  i = 3
  while i <= max
    ans += is_prime(i)
    i += 2
  end
  return ans
end

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

while n = gets
  puts prime_array_size(n.to_i)
  p $prime
end