def prosti(n):
    sito = [False, False] + [True] * (n-1)    
    i = 2
    while i <= n:
        if sito[i]:                 
            j = 2 * i               
            while j <= n:
                sito[j] = False     
                j = j + i          
        i = i + 1                   
    
    return sito
n=int(input())
for i in range(n):
    res=0
    brslicica=int(input())
    poc=brslicica//2
    nizsvihprostih=prosti(brslicica+1)
    for i in range (poc,brslicica+1):
        if nizsvihprostih[i]: res+=1
    print(brslicica-res)