#include <bits/stdc++.h>
using namespace std;
void solveK_Indivisibility() {
  long long n;
  cin >> n;
  long long res = n - n / 2 - n / 3 - n / 5 - n / 7;
  res += n / 6 + n / 10 + n / 14 + n / 15 + n / 21 + n / 35;
  res -= n / 30 + n / 42 + n / 70 + n / 105;
  res += n / 210;
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solveK_Indivisibility();
}
