#include <bits/stdc++.h>
using namespace std;
void solve(){
long long n;
cin >> n;
long long ans = 0;
for(int i = 1 ; i <= min((long long)1e6,n) ; i++){
ans += n / i - 1;
}
if(n <= 1e6){
cout << ans << endl;
return;
}
for(int i = n / (int)1e6 + 1 ; i >= 1 ; i--){
ans += max(0ll,(n / i - max((long long)1e6+1,n / (i + 1))));
}
// if(n <= MX) cout << dp[n] << endl;
// else{
// long long ans = dp[MX] - (n - MX);
// int j = MX + 1;
// while(n / j == n / MX){
// ans += n / j;
// j++;
// }
// cout << ans << endl;
// for(int k = n / j ; k >= 1 ; k--){
// ans += k * (n / k - n / (k + 1));
// }
// cout << ans << endl;
// }
cout << long(ans - (n - 1e6) + 1) << endl;
}
int main()
{
int t = 1;
cin >> t;
while(t--) solve();
return 0;
}