#include <iostream>
using namespace std;
int main() {
long x;
cin >> x;
int sum = -1;
for(long i = 1; i<= x; i *= 7){
for(long j = i; j <= x; j *= 5) {
for(long k = j; k <= x; k *= 3){
++sum;
}
}
}
cout << sum << endl;
return 0;
}