#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL; typedef pair PII; typedef vector VI; typedef vector VPII; typedef pair PLL; typedef pair PIL; typedef pair PLI; typedef double DB; typedef long double LD; #define pb push_back #define all(x) (x).begin(), (x).end() #define bit(x) (1 << (x)) #define bitl(x) (1LL << (x)) #define sqr(x) ((x) * (x)) #define sz(x) ((int)(x.size())) #define counti(x) (__builtin_popcount(x)) #define countl(x) (__builtin_popcountll(x)) #define rep(i, n) for (int (i) = 0; (i) < (int)(n); ++(i)) #define X first #define Y second template inline void chkmax(T& x, U y) { if (x < y) x = y; } template inline void chkmin(T& x, U y) { if (y < x) x = y; } int get() { char c; while (c = getchar(), (c < '0' || c > '9') && (c != '-')); bool flag = (c == '-'); if (flag) c = getchar(); int x = 0; while (c >= '0' && c <= '9') { x = x * 10 + c - 48; c = getchar(); } return flag ? -x : x; } void output(int x) { if (x < 0) { putchar('-'); x = -x; } int len = 0, data[20]; while (x) { data[len++] = x % 10; x /= 10; } if (!len) data[len++] = 0; while (len--) putchar(data[len] + 48); putchar('\n'); } #define MX 1234567 int f[MX], g[MX]; void init() { int i, j; for (i = 2; i < MX; ++i) f[i] = i; for (i = 2; i < MX; i ++) if (f[i] == i) { for (j = 2 * i; j < MX; j += i) f[j] = i; } g[2] = 1, g[3] = 2; g[1] = 1; for (i = 4; i < MX; i++) { if (f[i] == i) g[i] = i - 1; else { int k = i; int c = 1, d = f[i]; while (k % d == 0) c *= d, k /= d; g[i] = c / d * (d - 1) * g[k]; } } } int gg[MX]; int main() { int Tcase; for (scanf("%d", &Tcase); Tcase--;) { int n; scanf("%d", &n); n++; int i, j; LL cnt = 0; for (j = 1; j <= n; j++) gg[j] = 1; for (j = 1; j <= n; j++) if ((n % j) == 0) for (int k = j; k <= n; k += j) gg[k] = max(gg[k], j); for (j = 1; j <= n; j++) if (gg[j] == 1) cnt++; cout << cnt << endl; } return 0; }