#include int main(void) { int is_composite[100001] = {0}; int sum[100001] = {0}; is_composite[0] = is_composite[1] = 1; sum[0] = sum[1] = 0; for (int i = 2; i < 100001; ++i) { sum[i] = sum[i - 1]; if (!is_composite[i]) { sum[i]++; for (int j = i + i; j < 100001; j += i) is_composite[j] = 1; } } int q; scanf("%d", &q); while (q--) { int x; scanf("%d", &x); printf("%d\n", sum[x]); } return 0; }