#include<iostream>
#include<fstream>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
	ifstream fi("SSD.INP");
	long long n;
	fi>>n;
	fi.close();
	ofstream fo("SSD.OUT");
	if(n<=5)
    {
        fo<<0;
    }
    else if(n>5)
    {
        long long dem=0;
        for (long long i=5;i<n;i++)
        {
            int kt=1;
            for(long long j=2;j*j<=i;j++)
            {
                if(i%j==0){kt=0;break;}
            }
            if(kt==1)
            {
                int ktra=1;
                for(long long j=2;j*j<=i-2;j++)
                {
                    if((i-2)%j==0){ktra=0;break;}
                }
            if (ktra==1){dem++;}
            }
        }
        fo<<dem;
    }
}
