X=[[] for i in range(62)] INF=10**18 for i in range(4,62): j=1 while (j**i)<=INF: X[i].append(j**i) j+=1 for t in range(int(input())): K=int(input()) L,R=0,INF while L>1 S=set() for i in range(4,62): for j in range(len(X[i])): if X[i][j]<=M: S.add(X[i][j]) else: break A=len(S) x=int(M**0.5) for i in range(x-2,x+2): if i>=0 and (i+1)*(i+1)>M: x=i break A+=x S=set() for i in range(4,62,2): for j in range(len(X[i])): if X[i][j]<=M: S.add(X[i][j]) else: break A-=len(S) x=int(M**(1/3)) for i in range(x-2,x+2): if i>=0 and (i+1)*(i+1)*(i+1)>M: x=i break A+=x S=set() for i in range(6,62,3): for j in range(len(X[i])): if X[i][j]<=M: S.add(X[i][j]) else: break A-=len(S) if A