#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { constexpr int m = 100'000; vector is_prime(m + 1, true); is_prime[0] = is_prime[1] = false; for (ll i = 2; i <= m; ++i) { if (!is_prime[i]) continue; for (ll j = i * i; j <= m; j += i) is_prime[j] = false; } vector cnt(m + 1, 0); for (int i = 1; i <= m; ++i) cnt[i] = cnt[i - 1] + is_prime[i]; int t; cin >> t; while (t--) { int n; cin >> n; cout << cnt[n] << endl; } return 0; }