#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int T = 1;
  while (T--) {
    long long int n, k, m, i, j, t, res = 0, arr[] = {2, 3, 5, 7}, cnt;
    cin >> n;
    string s[20];
    for (i = 1; i < 16; i++) {
      t = i;
      while (t > 0) {
        s[i] += (t % 2 + '0');
        t /= 2;
      }
      while (s[i].size() < 4) s[i] += '0';
    }
    res = n;
    for (i = 1; i < 16; i++) {
      t = 1;
      cnt = 0;
      for (j = 0; j < 4; j++) {
        if (s[i][j] == '1') {
          t *= arr[j];
          cnt++;
        }
      }
      if (cnt % 2 == 1)
        res -= (n / t);
      else
        res += (n / t);
    }
    cout << res << endl;
  }
}
