def prime_number(n)
  r = (0..n).to_a
  r[0] = r[1] = nil
  for d in r
    next unless(d)
    break if n**0.5 < d
    (2*d..n).step(d){|e| r[e] = nil}
  end
  r.delete(nil)
  return r
end

primes = prime_number(999999)


n = gets.to_i

n.times do
  x = gets.to_i
  puts primes.select {|item| item < x}.size
end