#include <iostream>
#include <algorithm>
#include<vector>

int main() {
	int n;
	while (std::cin >> n) {
		int a = 0;
		if (n == 0) {
			break;
		}
		for (int i = 2; i <= n; ++i) {
			bool f = true;
			for (int j = 2; j < i&&f; ++j) {
				if (i%j == 0) {
					f = false;
				}
			}
			if (i == 2) {
				++a;
			}
			else if (f) {
				++a;
			}
		}
		std::cout << a << std::endl;
	}
	return 0;
}