#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int count = 0;
for (int i = 1; i <= n; i++) {
if (i % 3 == 2 && i % 5 == 3 && i % 7 == 2) {
count++;
}
}
cout << count << endl;
return 0;
}
/**************************************************************
Problem: 1055
User: fuyijun
Language: C++
Result: Accepted
Time:10 ms
Memory:2072 kb
****************************************************************/