import sys
def solve():
"""
This function precomputes all answers and then handles the test cases.
"""
# --- Precomputation Phase ---
# This part runs only once to prepare answers for all possible N up to 10^6.
MAX_N = 10**6 + 1
# Step 1: Calculate tau(k) for all k up to MAX_N using a sieve.
# tau[k] will store the number of divisors of k.
# Complexity: O(MAX_N * log(MAX_N))
tau = [0] * MAX_N
for i in range(1, MAX_N):
for multiple in range(i, MAX_N, i):
tau[multiple] += 1
# Step 2: Compute the prefix sums to get the answer for each N.
# answers[n] will store the total number of harmonious pairs for an army of size n.
# Complexity: O(MAX_N)
answers = [0] * MAX_N
# ans[0] and ans[1] are 0, as no pairs (i, j) with i < j exist.
for n in range(2, MAX_N):
# The number of new harmonious pairs where the larger number is n
# is equal to the number of proper divisors of n, which is tau[n] - 1.
new_pairs_at_n = tau[n] - 1
answers[n] = answers[n-1] + new_pairs_at_n
# --- Query Phase ---
# Process each test case using the precomputed answers.
try:
# Read the number of test cases.
num_test_cases = int(sys.stdin.readline())
# Process each test case.
for _ in range(num_test_cases):
# Read the value of N for the current test case.
n = int(sys.stdin.readline())
# The answer is precomputed, so it's a direct O(1) lookup.
sys.stdout.write(str(answers[n]) + '\n')
except (IOError, ValueError):
# Gracefully handle potential empty input or parsing errors.
return
# Call the main function to run the solution.
if __name__ == "__main__":
solve()