#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  while (scanf("%lld", &a) != EOF) {
    long long sum;
    sum = (a - (a / 2 + a / 3 + a / 5 + a / 7) +
           (a / 6 + a / 10 + a / 14 + a / 15 + a / 21 + a / 35) - a / 30 -
           a / 42 - a / 70 - a / 105 + a / 210);
    cout << sum << endl;
  }
  return 0;
}
