#include <bits/stdc++.h>
using namespace std;
void solve2() {
  long long x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int cx1 = x1, cx2 = x2, cy1 = y1, cy2 = y2;
  cx1 = (x2 - x1) / 2 + 1;
  cx2 = (x2 - x1) / 2;
  cy1 += (x1 + y1) % 2;
  cy2 -= (x1 + y2) % 2;
  int hy1 = ((cy2 - cy1) / 2 + 1) * (cy2 >= cy1);
  ++x1;
  cy1 = y1;
  cy2 = y2;
  cy1 += (x1 + y1) % 2;
  cy2 -= (x1 + y2) % 2;
  int hy2 = ((cy2 - cy1) / 2 + 1) * (cy2 >= cy1);
  cout << hy1 * cx1 + hy2 * cx2;
}
void solve() {
  long long n;
  cin >> n;
  int d[] = {2, 3, 5, 7};
  long long all = 0;
  for (int(i) = 0; (i) < (4); ++(i)) {
    all += n / d[i];
  }
  for (int(i) = 0; (i) < (4); ++(i)) {
    for (int(j) = (i + 1); (j) < (4); ++(j)) {
      all -= n / (d[i] * d[j]);
    }
  }
  for (int(i) = 0; (i) < (4); ++(i)) {
    for (int(j) = (i + 1); (j) < (4); ++(j)) {
      for (int(k) = (j + 1); (k) < (4); ++(k)) {
        all += n / (d[i] * d[j] * d[k]);
      }
    }
  }
  all -= n / (3 * 5 * 7 * 2);
  cout << n - all;
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
