#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int T = 1;
  while (T--) {
    long long int n;
    cin >> n;
    long long int g = n / 2 + (n % 2 != 0);
    long long int y3 = 0, y5 = 0, y7 = 0, y15 = 0, y21 = 0, y35 = 0, y105 = 0;
    long long int k = n;
    while (k > 0) {
      if (k % 3 == 0) {
        y3 = k;
        break;
      }
      k--;
    }
    k = n;
    while (k > 0) {
      if (k % 5 == 0) {
        y5 = k;
        break;
      }
      k--;
    }
    k = n;
    while (k > 0) {
      if (k % 7 == 0) {
        y7 = k;
        break;
      }
      k--;
    }
    k = n;
    while (k > 0) {
      if (k % 15 == 0) {
        y15 = k;
        break;
      }
      k--;
    }
    k = n;
    while (k > 0) {
      if (k % 21 == 0) {
        y21 = k;
        break;
      }
      k--;
    }
    k = n;
    while (k > 0) {
      if (k % 35 == 0) {
        y35 = k;
        break;
      }
      k--;
    }
    k = n;
    while (k > 0) {
      if (k % 105 == 0) {
        y105 = k;
        break;
      }
      k--;
    }
    long long int c3, c5, c7, c15, c21, c35, c105;
    c3 = (y3 - 3) / 3 + 1;
    c5 = (y5 - 5) / 5 + 1;
    c7 = (y7 - 7) / 7 + 1;
    c15 = (y15 - 15) / 15 + 1;
    c21 = (y21 - 21) / 21 + 1;
    c35 = (y35 - 35) / 35 + 1;
    c105 = (y105 - 105) / 105 + 1;
    c3 = c3 / 2 + (c3 % 2 != 0);
    c5 = c5 / 2 + (c5 % 2 != 0);
    c7 = c7 / 2 + (c7 % 2 != 0);
    c15 = c15 / 2 + (c15 % 2 != 0);
    c21 = c21 / 2 + (c21 % 2 != 0);
    c35 = c35 / 2 + (c35 % 2 != 0);
    c105 = c105 / 2 + (c105 % 2 != 0);
    cout << g - c3 - c5 - c7 + c15 + c21 + c35 - c105;
  }
  return 0;
}
