#include<bits/stdc++.h>
#define N 100010
using namespace std;
int f[N] ,g[N], T, x, t;

int main(){
	freopen("prime.in", "r", stdin);
	freopen("prime.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin >> T;
    int ma = 100000;
    for(int i = 2; i <= ma; i ++){
        if(f[i] == 0){
            t ++;
            g[t] = i;
        }
        for(int j = 1; j <= t && i * g[j] <= ma; j ++){
            f[i * g[j]] = 1;
            if(i % g[j] == 0) break;
        }
    }
    memset(f, 0, sizeof(f));
    for(int i = 1; i <= t; i ++) g[i] += g[i-1];
    for(int i = 1; i < t; i++){
        for(int j = i; j <= t; j++)
            if(g[j] - g[i - 1] <= 100000)
                f[g[j] - g[i - 1]] ++;
    }
    while(T --){
        cin >> x;
        cout << f[x] << "\n";
    }
    return 0;
}
