using System; using System.Collections.Generic; using System.Linq; class G { static void Main() => Console.WriteLine(Solve()); static object Solve() { var t = int.Parse(Console.ReadLine()); var ns = Array.ConvertAll(new bool[t], _ => int.Parse(Console.ReadLine())); var ps = GetPrimes(ns.Max()); return string.Join("\n", ns.Select(n => ps.TakeWhile(p => p <= n).Count())); } static int[] GetPrimes(int n) { var b = new bool[n + 1]; for (int p = 2; p * p <= n; ++p) if (!b[p]) for (int x = p * p; x <= n; x += p) b[x] = true; var r = new List(); for (int x = 2; x <= n; ++x) if (!b[x]) r.Add(x); return r.ToArray(); } }