#include <bits/stdc++.h>
const int N = 100005;
const long double pi = 3.141592653;
const long long MOD = 1000000007;
using namespace std;
int dx[9] = {1, -1, 0, 0, 1, 1, -1, -1, 0};
int dy[9] = {0, 0, 1, -1, 1, -1, 1, -1, 0};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    long long n;
    cin >> n;
    cout << n - (n / 2 + n / 3 + n / 5 + n / 7) +
                (n / 6 + n / 10 + n / 14 + n / 15 + n / 21 + n / 35) -
                (n / 30 + n / 42 + n / 70 + n / 105) + n / 210;
  }
  return 0;
}
