import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i = 0 ; i < n ; i++){ Set list = constructPrimeNumbers(sc.nextInt()); System.out.println(list.size()); } } private static Set constructPrimeNumbers(int maxNumber) { Set primeNumbers = new HashSet(); boolean[] targetNumbers = new boolean[maxNumber + 1]; Arrays.fill(targetNumbers, true); targetNumbers[0] = false; targetNumbers[1] = false; int sqrt = (int) Math.sqrt(maxNumber); for (int i = 2; i <= sqrt; i++) { int firstNum = i; if (targetNumbers[i]) { for (int j = i * firstNum; j < targetNumbers.length; j = j + firstNum) { targetNumbers[j] = false; } } } for (int i = 2; i < targetNumbers.length; i++) { if (targetNumbers[i]) { primeNumbers.add(i); } } return primeNumbers; } }