#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int INF = 2e9;
const long long LNF = 9e18;
const int mod = 1e9 + 7;
const int maxn = 1e3 + 10;
long long n;
void init() {
  cin >> n;
  long long a[4] = {2, 3, 5, 7};
  long long ans = 0;
  for (int s = 1; s < (1 << 4); s++) {
    long long cnt = 0, val = 1;
    for (int j = 0; j < 4; j++)
      if ((1 << j) & s) {
        cnt++;
        val *= a[j];
      }
    ans += (cnt & 1) ? (n / val) : (-n / val);
  }
  cout << n - ans << endl;
}
void solve() {}
int main() {
  init();
  solve();
}
