#include using namespace std; int main(){ int f[] = {3,5,17,257,65537}; int a,ans = 0; cin >> a; for(int i = 0;i < 30;i++){ for(int j = 0;j < 32;j++){ long long x = (1 << i); for(int k = 0;k < 5;k++) if(j >> k & 1) x *= f[k]; if(x >= 3 && x <= a) ans++; } } cout << ans << endl; }