#include struct is_prime { bool v[100100]{}; is_prime() : v() { v[0] = v[1] = true; for (int i = 2; i < 100100; i++) { if (!v[i]) { int tmp = i; while ((tmp += i) < 100100) v[tmp] = true; } } } bool operator()(int x) const { return !v[x]; } }; int acc[100100]; int main() { const is_prime p; int n, a; std::cin >> n; for (int i = 2; i < 100100; i++) acc[i] = acc[i - 1] + p(i); while (n--) { std::cin >> a; std::cout << acc[a] << "\n"; } }