#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <assert.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;
#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
const int maxn = 50000 + 20;
int prime[maxn];
bool check[maxn];
int total;
int Size[maxn];
int his[maxn][50 + 20];
void initprime() {
for (int i = 2; i <= maxn - 20; i++) {
if (!check[i]) {
prime[++total] = i;
}
for (int j = 1; j <= total; j++) {
if (i * prime[j] > maxn - 20) break;
check[i * prime[j]] = 1;
if (i % prime[j] == 0) break;
}
}
for (int i = 1; i <= maxn - 20; ++i) {
int t = i;
for (int j = 1; j <= total; ++j) {
if (prime[j] > t) break;
if (t % prime[j] == 0) {
his[i][++Size[i]] = prime[j];
while (t % prime[j]) {
t /= prime[j];
}
}
}
}
return ;
}
LL calc(int up, int cur, int number, int tobuild, int flag) {
LL ans = 0;
for (int i = cur; i <= Size[number]; ++i) {
if (flag == 0) {
ans += up / (his[number][i] * tobuild);
} else ans -= up / (his[number][i] * tobuild);
ans += calc(up, i + 1, number, his[number][i] * tobuild, !flag);
}
return ans;
}
void work() {
int n;
cin >> n;
int en = (int)sqrt(n + 0.5);
// cout << en << endl;
LL ans = 0;
for (int i = 2; i <= en; ++i) {
ans += n / i - calc(n / i, 1, i, 1, 0);
ans -= i - calc(i, 1, i, 1, 0);
// cout << calc(n / i, 1, i, 1, 0) << " " << calc(i, 1, i, 1, 0) << endl;
// cout << ans << endl;
}
cout << ans << endl;
}
int main() {
#ifdef local
freopen("data.txt", "r", stdin);
// freopen("data.txt", "w", stdout);
#endif
initprime();
work();
return 0;
}