#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int nu[30];
	int num;
	int count = 1;
	int max = 29;
	for(int x=0;x<30;x++){
		nu [x] = -1;
		cin >> nu[x];
		if (nu[x] == -1) {
			max = x;
			break;
		}
	}
	for (int y=0;y<max;y++) {
		num = nu[y];
		count = 1;
	for (int i = 1;i<=num;i++) {
		
		for (int j=2;j<i;j++) {
			if (i%j==0) {
				count ++;
				break;
			}
			
		}
	}
	cout << (num-count) <<endl;
	}
	return 0;
}