n = int(input())
print(n-(n//2)-(n//3)-(n//5)-(n//7)+(n//6)+(n//10)+(n//14)+(n//15)+(n//21)+(n//35)-(n//30)-(n//105)-(n//42)-(n//70)+(n//210))
#include<bits/stdc++.h>
using namespace std;
typedef long long l1;
#define ios ios::sync_with_stdio(false);cin.tie(0);
#define rep(i, a, n) for(int (i) = (int)a; (i) < (int)(n); ++(i))
#define REP(i, a, n) for(int (i) = (int)a; (i) <= (int)(n); ++(i))
const l1 MOD = 1e9 + 7;
template <typename T>
void print(vector<T>v)
{
for(auto it: v)cout<<it<<" ";
cout<<"\n";
}
l1 n;
int main()
{
ios
int test = 1;
//cin >> test;
while(test--)
{
//l1 n;
cin >> n;
vector<l1>v = {2,3,5,7};
l1 ans = n;
rep(a, 0, 4)ans-= n/v[a];
rep(a, 0, 4)
{
rep(b, a+1, 4)ans+= n/(v[a]*v[b]);
}
rep(a, 0, 4)
{
rep(b, a+1, 4)
{
rep(c, b+1, 4)ans-= n/(v[a]*v[b]*v[c]);
}
}
ans+= n/(v[0]*v[1]*v[2]*v[3]);
cout<<ans;
}
}
1719B - Mathematical Circus | 1719C - Fighting Tournament |
1642A - Hard Way | 285C - Building Permutation |
1719E - Fibonacci Strings | 1696C - Fishingprince Plays With Array |
1085A - Right-Left Cipher | 1508B - Almost Sorted |
1690C - Restoring the Duration of Tasks | 1055A - Metro |
1036D - Vasya and Arrays | 1139C - Edgy Trees |
37A - Towers | 353A - Domino |
409H - A + B Strikes Back | 1262A - Math Problem |
158C - Cd and pwd commands | 194A - Exams |
1673B - A Perfectly Balanced String | 1104B - Game with string |
1169B - Pairs | 1567D - Expression Evaluation Error |
78A - Haiku | 1287A - Angry Students |
1428A - Box is Pull | 234B - Reading |
581B - Luxurious Houses | 1481C - Fence Painting |
935A - Fafa and his Company | 22A - Second Order Statistics |