'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
# print 'Hello World!'
if __name__ == '__main__':
    p = [1]*1000001
    ans = [1]*1001
    for i in range(2, 1001):
    	if p[i]:
    		for j in range(i*i, 1000001, i):
    			if p[j]:
    				ans[i] += 1
    			p[j] = 0
    for t in range(input()):
        x = input()
        if x > 1000:
            print 1
        else:
            print ans[x]