#include<bits/stdc++.h>
using namespace std;

int tab[1000009];

void pre()
{
    long long a,b,c,d;
    for(int i=1; i<=1000000; i++)
    {
        a=i;
        for(int j=i+1; j<=1000000; j++)
        {
            b=j;
            b*=a;
            if(b>1000000) break;
            for(int k=j+1; k<=1000000; k++)
            {
                c=k;
                c=c*b;
                if(c<=1000000) tab[c]++;
                else break;
            }
        }
    }
    for(int i=1; i<=1000000; i++) tab[i]+=tab[i-1];
    return;
}

void solve()
{
    int a;
    cin>>a;
    cout<<tab[a];
}

int main()
{
    ios_base::sync_with_stdio(false);
    int t;
    cin>>t;
    pre();
    //cout<<"!";
    while(true)
    {
        solve();
        t--;
        if(t==0) break;
        else cout<<"\n";
    }
    return 0;
}
