#include using namespace std; using ll = long long; const ll mod = 1e9 + 7; const ll inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; template void print(vector vec) { int n = vec.size(); for (int i = 0; i < n; i++) { cout << vec[i] << (i == n - 1 ? "\n" : " "); } } int main() { vector f_list, ans; ll a, f[] = {3, 5, 17, 257, 65537}, p = 1; cin >> a; for (int i = 0; i < (1 << 5); i++) { p = 1; for (int j = 0; j < 5 && p < inf; j++) { if (i & (1 << j)) p *= f[j]; if (j == 4 && p < inf) f_list.push_back(p); } } //print(f_list); ll pow2 = 1; for(int i = 0;i < 32;i++, pow2 *= 2){ for(auto can : f_list){ ans.push_back(pow2 * can); } } sort(ans.begin(),ans.end()); int q = 0; for(int i = 0;i < ans.size();i++){ if(ans[i] < a && ans[i] >= 3)q++; } cout << q << endl; }