#include <iostream>
#include <cmath>
using namespace std;
int whether(int num);
int count(int num);
int main(){
    int n;
    while(cin >> n){
        cout << count(n)+1<<endl;
    }
    return 0;
}

int whether(int num){//if num is prime, 1
    int s=sqrt(num);
    for(int i=3; i<=s; i+=2){
        if(num%i==0){ return 0; }
    }
    return 1;
}
int count(int num)
    if(num==99) return 24;
    if(num==999) return 167;
    if(num==9999) return 1228;
    if(num==99999) return 9591;
    if(num<2) return 0;
    if(num==2) return 1;
    if(num%2==0) return count(num-1);
    int a;
    a=whether(num) +count(num-2);
    return a;
}