#include <bits/stdc++.h>
using namespace std;
long long n, ans, f[1 << 9];
long long gcd(long long x, long long y) {
  if (x % y == 0) return y;
  return gcd(y, x % y);
}
long long got(long long x) {
  long long ans = 0;
  while (x) {
    ans++;
    x = (x - 1) & x;
  }
  if (ans & 1)
    return -1;
  else
    return 1;
}
int main() {
  cin >> n;
  long long tot = (1 << 9) - 1;
  for (int i = 0; i <= tot; i++) {
    f[i] = 1;
    for (int j = 1; j <= 9; j++)
      if (i & 1 << (j - 1)) f[i] = (j + 1) * f[i] / gcd(f[i], j + 1);
    ans += got(i) * n / f[i];
  }
  cout << ans << endl;
}
