using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
class Myon
{
public Myon() { }
public static int Main()
{
new Myon().calc();
return 0;
}
const int block = 2 * 3 * 5 * 7 * 11 * 13 * 17;
long target;
void calc()
{
Stopwatch sw = new Stopwatch();
target = long.Parse(Console.ReadLine());
sw.Start();
first = new bool[block];
all = new int[block];
c = 0;
firstcalc();
for (long i = block; i < target; i += block)
{
calc(i);
}
Console.Error.WriteLine("prime count: " + count);
sw.Stop();
Console.Error.WriteLine(sw.ElapsedMilliseconds + "ms");
}
bool[] first;
int[] all;
int c;
long count = 0;
List<int> primes;
int[] firstp = new int[] { 2, 3, 5, 7, 11, 13, 17 };
void precalc()
{
first[0] = true;
foreach (var a in firstp)
{
for (int b = a; b < block; b += a)
{
first[a] = true;
}
}
}
List<int> li = new List<int>();
void firstcalc()
{
primes = new List<int>();
foreach (var p in firstp)
{
if (p > target) break;
addprime(p);
if ((long)p * p <= target)
{
primes.Add(p);
for (int j = p + p; j < block; j += p)
{
first[j] = true;
}
}
}
c++;
li.Add(1);
for (int i = 19; i < block; i++)
{
if (first[i]) continue;
li.Add(i);
if (all[i] == c) continue;
if (i <= target) addprime(i);
else break;
if ((long)i * i <= target)
{
primes.Add(i);
for (int j = i + i; j < block; j += i)
{
all[j] = c;
}
}
}
}
void calc(long b)
{
c++;
long max = b + block;
foreach (var p in primes)
{
if ((long)p * p > max) break;
int f = (int)(b % p);
if (f != 0) f = p - f;
if ((f & 1) == 0) f += p;
for (int j = f; j < block; j += p + p)
{
all[j] = c;
}
}
foreach (var i in li)
{
if (all[i] == c) continue;
long num = b + i;
if (num <= target) addprime(num);
else break;
}
}
void addprime(long a)
{
count++;
}
}