#include <bits/stdc++.h>
using namespace std;
long long n;
void input() { cin >> n; }
void solve() {
  cout << n - n / 2 - n / 3 - n / 5 - n / 7 + n / (2 * 3) + n / (2 * 5) +
              n / (2 * 7) + n / (3 * 5) + n / (7 * 3) + n / (5 * 7) -
              n / (2 * 3 * 5) - n / (2 * 5 * 7) - n / (2 * 3 * 7) -
              n / (7 * 3 * 5) + n / (2 * 3 * 5 * 7);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  long long t = 1;
  while (t--) {
    input();
    solve();
    cout << endl;
  }
  cin.get();
  return 0;
}
