#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long gcdd(long long a, long long b) {
  if (b == 0) return a;
  return gcdd(b, a % b);
}
double lcmm(double a, double b) { return (a * gcdd(a, b)) / b * 1.0; }
void readF() {}
bool compare(char a, char b) { return a >= b; }
string bin(long long x) {
  x = abs(x);
  string ans = "";
  for (int i = 0; i <= 62; i++) ans += "0";
  int i = ans.length() - 1;
  while (x > 0) {
    if (x % 2 != 0)
      ans[i] = '1';
    else
      ans[i] = '0';
    i--, x /= 2;
  }
  return ans;
}
string actBin(long long x) {
  string ans = bin(x);
  for (int i = 0; i < ans.length(); i++) {
    if (ans[i] == '1') return ans.substr(i);
  }
  return ans;
}
bool isPower2(long long x) { return x && !(x & (x - 1)); }
long long getCloser(long long x) {
  x |= (x >> 1);
  x |= (x >> 2);
  x |= (x >> 4);
  x |= (x >> 8);
  x |= (x >> 16);
  x |= (x >> 32);
  return (x + 1) >> 1;
}
long long getLastOne(long long x) { return x ^ (x & (x - 1)); }
double getDis(double a, double b, double c, double d) {
  return sqrt(pow(c - a, 2) + pow(d - b, 2));
}
pair<double, double> getMiddle(double a, double b, double c, double d) {
  return {(a + c) / 2, (d + b) / 2};
}
string act(string ans);
string act(string ans) {
  for (int i = 0; i < ans.length(); i++) {
    if (ans[i] != '0') return ans.substr(i);
  }
  return ans;
}
long double fact(long long x) {
  long double a = 1;
  for (int i = x; i >= 1; i--) {
    a *= i;
  }
  return a;
}
bool pali(string s) {
  string ss = s;
  reverse(ss.begin(), ss.end());
  return s == ss;
}
long long de(string s) {
  long long ans = 0;
  for (long long i = 0; i < s.size(); i++) {
    ans += pow(s[i] - '0', 2);
  }
  return ans;
}
void triangle(int x) {
  if (x <= 0) return;
  for (int i = 1; i <= x; i++) cout << "*";
  cout << '\n';
  triangle(x - 1);
}
void pN(int n) {
  if (n) {
    pN(n / 10);
    cout << n % 10 << " ";
  }
}
string bits(long long n) {
  __f("n", n);
  if (n == 0) return "";
  return bits(n / 2) + to_string(n % 2);
}
const int M = 500;
int grid[M][M];
long long n, m, k, l, r, d;
const int MX = 2e6;
long long a[MX + 5], b[MX];
set<long long> st;
string s1, s2;
vector<long long> v1, v2;
const int FMX = 100;
long long f[FMX + 9];
void fib() {
  f[1] = 1;
  f[2] = 1;
  for (long long i = 3; i <= FMX; i++) {
    f[i] = (f[i - 1] + f[i - 2]);
  }
}
long long sumOfEven(long long x) { return (x / 2) * ((x / 2) + 1); }
long long sumOfOdd(long long x) { return (x * (x + 1) / 2) - sumOfEven(x); }
long long sumToN(long long x) { return (x * (x + 1) / 2); }
long long getDiv(long long x) { return x / k; }
long long getFirst() {
  if (n % k == 0) return n;
  return k * ((n / k) + 1);
}
bool isEqual(double x, double y, double epsilon = 0.0000001f) {
  if (fabs(x - y) < epsilon) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  readF();
  int t = 1;
  while (t--) {
    long long n;
    cin >> n;
    cout << n - (n / 2) - (n / 5) - (n / 3) - (n / 7) + (n / (2 * 3)) +
                (n / (2 * 5)) + (n / (2 * 7)) + (n / (3 * 5)) + (n / (3 * 7)) +
                (n / (5 * 7)) - (n / (2 * 3 * 5)) - (n / (5 * 7 * 2)) -
                (n / (3 * 5 * 7)) - (n / (2 * 3 * 7)) + (n / (3 * 5 * 7 * 2))
         << '\n';
  }
  return 0;
}
