#include <stdio.h>

inline int IsPrime(int n);

int main(void){
    int n, cnt;
    int list[100000];

    cnt=0;
    for (long i=2; i<1000000; i++){
        if (i%10==0) list[i/10] = cnt;
        cnt += IsPrime(i);
    }
	printf("input : ");
    while (scanf("%d", &n) && n!=EOF){
        cnt = list[n/10];
        for (long i=1; i<n%10; i++){
            cnt += IsPrime(i);
        }
        printf("%d\n", cnt);
    }
    return 0;
}

inline int IsPrime(int n){
    int i;

    for (i=2; i*i<=n; i++){
        if (n%i==0) return 0;
    }
    return 1;
}