#include <bits/stdc++.h>
#define ll long long
#define un unsigned
#define de double
#define pi acos(-1.0)
#define FF first
#define SS second
#define pb push_back
#define mp make_pair
#define mem(ae, value) memset(ae, value, sizeof(ae))
#define all(x) x.begin( ), x.end( )
#define UNIQUE(x) x.resize(unique(all(x)) - x.begin())
#define FASTER ios_base::sync_with_stdio(0)
#define loop(begin, end) for(u int i=begin; i<=end; i++)
#define Read freopen("in.txt", "r", stdin)
#define Write freopen("out.txt", "w", stdout)
#define nl '\n'

using namespace std;

template<class T> inline T sq(T x) { return x*x; }
template <class T> inline T gcd(T a, T b) { if(b == 0) return a; return GCD(b, a%b); }
template <class T> inline T lcm(T a, T b) { return ( a/GCD(a, b) ) * b; }
template <class T> inline T power(T b, T p)
{
    if(p == 0) return 1;
    if(p == 1) return b;
    if(p&1) return b*power(b, p-1);
    else return sq(power(b, p>>1));
}

bool P[500000+10];

void sieve(int n)
{
    for(int i=3; i*i<=n; i+=2)
    {
        if( (P[i/2-1]) == 0 )
        {
            for(int j=i*i; j<=n; j+=2*i)
            {
                P[j/2-1] = 1;
            }
        }
    }
}

void display()
{
    for(int i=0; i<60; i++)
    {
        cout << i << " = " << (i*2+3) << " --- " << P[i] << nl;
    }
}


int main( )
{
    sieve(500000);
    int n;
    while(cin >> n)
    {
        int C=0;
        if( (n==1) or (n==2))
        {
            if(n==1) C=0;
            else
            {
                if(n==2) C=1;
            }
        }
        else
        {
            int upto;
            if((n&1))
            {
                upto = n/2 - 1;
            }
            else
            {
                upto = n/2 - 2;
            }
            int i=0;
            while(i<=upto)
            {
                if(P[i]==0) C ++;
                i ++;
            }
            C ++;
        }
        cout << C << nl;
    }
    //display( );

    return 0;
}