#include <bits/stdc++.h>
using namespace std;
constexpr int MM = 998244353;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  long long n;
  cin >> n;
  long long a = (n / 2) + (n / 3) + (n / 5) + (n / 7);
  long long b = (n / (2 * 3)) + (n / (2 * 5)) + (n / (2 * 7)) + (n / (3 * 5)) +
                (n / (7 * 3)) + (n / (5 * 7));
  long long c = (n / (2 * 3 * 5)) + (n / (2 * 3 * 7)) + (n / (2 * 7 * 5)) +
                (n / (7 * 3 * 5));
  long long d = (n / (2 * 3 * 5 * 7));
  cout << n - a + b - c + d;
  return 0;
}
