#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
#pragma GCC optimize("O3")
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000007LL;
const long long INF2 = 1000000007LL * 1000000007LL;
const long double EPS = 1e-9;
const int SIZE = 300100;
mt19937 rng(time(0));
uniform_int_distribution<int> uid(-1000000000, 1000000000);
long long d[800][10], u[800][10];
long long C(long long n, long long k) {
  if (k > n) return 0;
  if (k == n) return 1;
  if (k == 1) return n;
  if (u[n][k]) return d[n][k];
  u[n][k] = 1;
  return d[n][k] = C(n - 1, k - 1) + C(n - 1, k);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long cnt2 = n / 2, cnt3 = n / 3, cnt5 = n / 5, cnt7 = n / 7;
  long long cnt23 = n / 6, cnt25 = n / 10, cnt27 = n / 14, cnt35 = n / 15,
            cnt37 = n / 21, cnt57 = n / 35;
  long long cnt235 = n / 30, cnt237 = n / 42, cnt257 = n / 70, cnt357 = n / 105;
  long long cnt2357 = n / 210;
  cout << n - cnt2 - cnt3 - cnt5 - cnt7 + cnt23 + cnt25 + cnt27 + cnt35 +
              cnt37 + cnt57 - cnt235 - cnt237 - cnt257 - cnt357 + cnt2357;
  return 0;
}
