Ashu is very fond of Prime numbers and he like challenging his friends by giving them various problems based on Mathematics and Prime number. One of his friend Harshit is jealous and challenges him to solve a task. Task is :Given a prime number X, you need to give the count of all numbers in range 1 to 10^6 inclusive which  have minimum prime factor X.Help Ashu in solving this task.Input:First line consist of numer of test cases T.Each test case contains a single number X.Output:Output for each test case count of all numbers in range 1 to 10^6 inclusive which  have minimum prime factor X.Constraints:1 ≤ T ≤ 10^5Prime number X where 2 ≤ X ≤ 10^6

SAMPLE INPUT
2
2
11

SAMPLE OUTPUT
500000
20779

Explanation

The minimum prime factor of all even numbers in the range [2, 1000000] is 2, and there are 1000000/2 = 500000 such even numbers.
The numbers with minimum prime factor as 11 are: 11, 121, 143, ...
MAX = 10**6+1
primes = [1]*MAX
primes[0] = primes[1] = 0
for i in xrange(2,MAX):
    if primes[i]:
        for j in xrange(i*i,MAX,i):
            if primes[j]:
                primes[i] += 1
                primes[j] = 0
for _ in xrange(input()):
    x = input()
    print primes[x]