import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    auto ns = stdin.byLine().map!(to!int).array();
    auto m = ns.reduce!max()+1;
    auto p = new bool[m];
    auto c = new int[m];
    foreach(i;2..m)
    {
        c[i]=c[i-1];
        if(!p[i])
        {
            ++c[i];
            foreach(j;2..((m+i-1)/i))
                p[i*j]=true;
        }
    }
    ns.map!(n=>c[n].to!string()).join("\n").writeln();
}