#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// #define int long long
const int MOD = 1000000007;
#define sz(x) (ll)(x).size()
#define rd ({ll x; cin >> x; x; })
#define dbg(x) cerr << "[" #x "] " << (x) << "\n"
// #define errv(x) {cerr << "["#x"] ["; for (const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
// #define cerr if(0)cerr
#define xx first
#define yy second
mt19937 rnd(std::chrono::high_resolution_clock::now().time_since_epoch().count());
/*_________________________________________________________________________________________________________________________*/
vector<ll> divi[1000001];
ll precalc[1000001];
void Solve()
{
ll n;
cin >> n;
cout << precalc[n] << "\n";
}
int32_t main()
{
for (int i = 1; i <= 1000000; i++)
for (int j = 2 * i; j <= 1000000; j += i)
divi[j].push_back(i);
for (ll i = 2; i <= 1000000; i++) {
for (auto& it : divi[i]) {
ll calc = i - it;
if (__gcd(i, calc) == it) {
precalc[i]++;
}
}
precalc[i] += precalc[i - 1];
}
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t = 1;
cin >> t;
for (int i = 1; i <= t; i++) {
// cout << "Case #" << i << ": "; // cout << "Case " << i << ": ";
Solve();
}
return 0;
}
// Coded by Tahsin Arafat (@TahsinArafat)