#include using namespace std; const int fermat[] = { 3, 5, 17, 257, 65537 }; int main() { long long a; cin >> a; int result = 0; for (unsigned int use = 0x0; use < (0x1 << 5); ++use) { long long product = 1; for (int i = 0; i < 5; ++i) { if ((use & (1 << i)) != 0) { product *= fermat[i]; } } for (int m = 0; m < 32; ++m) { long long n = (1LL << m) * product; if (3 <= n && n <= a) { ++result; } } } cout << result << endl; return 0; }