#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
const int maxn = 1e6 + 6;
long long primes[maxn];
long long d[1000];
int size_d = 0;
long long dd[1000][2];
int cur_d = 0;
long long tmpans = 0;
long long bound = 0;
void rec(int pos, long long mask, int sign)
{
if (pos == cur_d) {
tmpans += sign * (bound / mask);
return;
}
int tmp = 1;
int si = 1;
for (int i = 0; i <= 1; i++) {
rec(pos + 1, mask * tmp, sign * si);
si = -si;
tmp = tmp * dd[pos][0];
}
}
long long solve(int p, int r)
{
if (p == 1)
return r;
bound = r;
int size_d = 0;
while (primes[p] != 1)
{
d[size_d++] = primes[p];
p /= primes[p];
}
sort(d, d + size_d);
dd[0][0] = d[0];
dd[0][1] = 1;
cur_d = 1;
for (int i = 1; i < size_d; i++)
{
if (d[i] == d[i - 1])
{
dd[cur_d - 1][1]++;
} else
{
dd[cur_d][0] = d[i];
dd[cur_d][1] = 1;
cur_d++;
}
}
tmpans = 0;
rec(0, 1, 1);
return tmpans;
}
int main()
{
int n = 0;
cin >> n;
int m = sqrt(n);
for (int i = 1; i <= m; i++)
primes[i] = i;
for (int i = 2; i * i <= m; i++)
{
if (primes[i] == i)
{
for (int j = i * i; j <= m; j += i)
primes[j] = i;
}
}
ans = 0;
for (int i = 2; i * i < n; i++) {
int r = n / i;
ans += solve(i, r) - solve(i, i);
}
cout << ans << endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKbG9uZyBsb25nIGFucyA9IDA7CmNvbnN0IGludCBtYXhuID0gMWU2ICsgNjsKbG9uZyBsb25nIHByaW1lc1ttYXhuXTsKbG9uZyBsb25nIGRbMTAwMF07CmludCBzaXplX2QgPSAwOwpsb25nIGxvbmcgZGRbMTAwMF1bMl07CmludCBjdXJfZCA9IDA7CmxvbmcgbG9uZyB0bXBhbnMgPSAwOwpsb25nIGxvbmcgYm91bmQgPSAwOwoKdm9pZCByZWMoaW50IHBvcywgbG9uZyBsb25nIG1hc2ssIGludCBzaWduKQp7CiAgICBpZiAocG9zID09IGN1cl9kKSB7CiAgICAgICAgdG1wYW5zICs9IHNpZ24gKiAoYm91bmQgLyBtYXNrKTsKICAgICAgICByZXR1cm47CiAgICB9CiAgICBpbnQgdG1wID0gMTsKICAgIGludCBzaSA9IDE7CiAgICBmb3IgKGludCBpID0gMDsgaSA8PSAxOyBpKyspIHsKICAgICAgICByZWMocG9zICsgMSwgbWFzayAqIHRtcCwgc2lnbiAqIHNpKTsKICAgICAgICBzaSA9IC1zaTsKICAgICAgICB0bXAgPSB0bXAgKiBkZFtwb3NdWzBdOwogICAgfQp9Cgpsb25nIGxvbmcgc29sdmUoaW50IHAsIGludCByKQp7CiAgICBpZiAocCA9PSAxKQogICAgICAgIHJldHVybiByOwogICAgYm91bmQgPSByOwogICAgaW50IHNpemVfZCA9IDA7CiAgICB3aGlsZSAocHJpbWVzW3BdICE9IDEpCiAgICB7CiAgICAgICAgZFtzaXplX2QrK10gPSBwcmltZXNbcF07CiAgICAgICAgcCAvPSBwcmltZXNbcF07CiAgICB9CiAgICBzb3J0KGQsIGQgKyBzaXplX2QpOwogICAgZGRbMF1bMF0gPSBkWzBdOwogICAgZGRbMF1bMV0gPSAxOwogICAgY3VyX2QgPSAxOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPCBzaXplX2Q7IGkrKykKICAgIHsKICAgICAgICBpZiAoZFtpXSA9PSBkW2kgLSAxXSkKICAgICAgICB7CiAgICAgICAgICAgIGRkW2N1cl9kIC0gMV1bMV0rKzsKICAgICAgICB9IGVsc2UKICAgICAgICB7CiAgICAgICAgICAgIGRkW2N1cl9kXVswXSA9IGRbaV07CiAgICAgICAgICAgIGRkW2N1cl9kXVsxXSA9IDE7CiAgICAgICAgICAgIGN1cl9kKys7CiAgICAgICAgfQogICAgfQogICAgdG1wYW5zID0gMDsKICAgIHJlYygwLCAxLCAxKTsKICAgIHJldHVybiB0bXBhbnM7Cn0KCmludCBtYWluKCkKeyAgICAgCiAgICBpbnQgbiA9IDA7CiAgICBjaW4gPj4gbjsKICAgIGludCBtID0gc3FydChuKTsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG07IGkrKykKICAgICAgICBwcmltZXNbaV0gPSBpOwogICAgZm9yIChpbnQgaSA9IDI7IGkgKiBpIDw9IG07IGkrKykKICAgIHsKICAgICAgICBpZiAocHJpbWVzW2ldID09IGkpCiAgICAgICAgewogICAgICAgICAgICBmb3IgKGludCBqID0gaSAqIGk7IGogPD0gbTsgaiArPSBpKQogICAgICAgICAgICAgICAgcHJpbWVzW2pdID0gaTsKICAgICAgICB9CiAgICB9CiAgICBhbnMgPSAwOwogICAgZm9yIChpbnQgaSA9IDI7IGkgKiBpIDwgbjsgaSsrKSB7CiAgICAgICAgaW50IHIgPSBuIC8gaTsKICAgICAgICBhbnMgKz0gc29sdmUoaSwgcikgLSBzb2x2ZShpLCBpKTsKICAgIH0KICAgIGNvdXQgPDwgYW5zIDw8IGVuZGw7CiAgICByZXR1cm4gMDsKfQ==