#include <iostream>
#include <chrono>
#include <vector>
#include <memory>
class Myon
{
public:
Myon()=default;
private:
static constexpr int block = 2 * 3 * 5 * 7 * 11 * 13 * 17;
long target;
public:
void calc()
{
//Stopwatch sw = new Stopwatch();
//
//target = long.Parse(Console.ReadLine());
std::cin >> target;
//sw.Start();
auto time_start = std::chrono::high_resolution_clock::now() ;
first = std::unique_ptr<bool[]>(new bool[block]);
all = std::unique_ptr<int[]>(new int[block]);
c = 0;
firstcalc();
for (long i = block; i < target; i += block)
{
calc(i);
}
//Console.Error.WriteLine("prime count: " + count);
std::cerr << "prime count: " << count << std::endl;
//sw.Stop();
auto time_end = std::chrono::high_resolution_clock::now() ;
auto sw = std::chrono::duration_cast< std::chrono::milliseconds >(
time_end -time_start ).count() ;
//Console.Error.WriteLine(sw.ElapsedMilliseconds + "ms");
std::cerr << sw << "ms" << std::endl;
}
private:
std::unique_ptr<bool[]> first;
std::unique_ptr<int[]> all;
int c;
long count = 0;
std::vector<int> primes;
static constexpr std::initializer_list<int const> firstp = { 2, 3, 5, 7, 11, 13, 17 };
void precalc()
{
first[0] = true;
for (auto a : firstp)
{
for (int b = a; b < block; b += a)
{
first[a] = true;
}
}
}
//List<int> li = new List<int>();
std::vector<int> li;
void firstcalc()
{
//primes = new List<int>();
for (auto p : firstp)
{
if (p > target) break;
addprime(p);
if ((long)p * p <= target)
{
primes.push_back(p);
for (int j = p + p; j < block; j += p)
{
first[j] = true;
}
}
}
c++;
li.push_back(1);
for (int i = 19; i < block; i++)
{
if (first[i]) continue;
li.push_back(i);
if (all[i] == c) continue;
if (i <= target) addprime(i);
else break;
if ((long)i * i <= target)
{
primes.push_back(i);
for (int j = i + i; j < block; j += i)
{
all[j] = c;
}
}
}
}
void calc(long b)
{
c++;
long max = b + block;
for (auto p : 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;
}
}
for (auto i : li)
{
if (all[i] == c) continue;
long num = b + i;
if (num <= target) addprime(num);
else break;
}
}
void addprime(long a)
{
count++;
}
};
constexpr std::initializer_list<int const> Myon::firstp;
auto main() -> int
{
Myon().calc();
return 0;
}