#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
template <typename T>
inline T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
inline T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
template <typename T>
string toStr(T x) {
  stringstream st;
  st << x;
  string s;
  st >> s;
  return s;
}
template <class T>
void splitStr(const string &s, vector<T> &out) {
  istringstream in(s);
  out.clear();
  copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}
inline long long two(long long n) { return 1 << n; }
inline long long isOnBit(long long n, long long b) { return (n >> b) & 1; }
inline void onBit(long long &n, long long b) { n |= two(b); }
inline void offBit(long long &n, long long b) { n &= ~two(b); }
inline long long lastBit(long long n) { return n & (-n); }
inline long long cntBit(long long n) {
  long long res = 0;
  while (n && ++res) n -= n & (-n);
  return res;
}
const long long dx4[] = {-1, 0, 1, 0};
const long long dy4[] = {0, 1, 0, -1};
const long long dx8[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const long long dy8[] = {0, 1, 0, -1, -1, 1, -1, 1};
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long modexp(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(15);
  mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
  long long n, t;
  t = 1;
  while (t--) {
    cin >> n;
    long long a = n / 2, b = n / 3, c = n / 5, d = n / 7;
    long long e = n / 6, f = n / 14, g = n / 15, h = n / 35;
    long long x = a + b + c + d - e - f - g - h;
    x -= n / 10;
    x -= n / 21;
    x += n / 30 + n / 42 + n / 70 + n / 105;
    x -= n / 210;
    cout << n - x << '\n';
  }
}
