#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define F first 
#define S second
#define PB push_back
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;

typedef LL ut;
typedef vector<ut> VI;
const ut INF=1<<30;
const int SIZE=1e+6;
const ut eps=1e-9;
VI primes;
LL fel(ut x){
	return (1LL<<(1LL<<x))+1;
}
int main(){
	LL times=0;
	LL n;
	cin >> n;
	times-=2;
	REP(i,1<<5){
		LL now=1;
		REP(j,5)
			if(i&(1<<j)) now*=fel(j);
		while(now<=n){
			times++;
			now*=2;		
		}
	}
	cout << times << endl;
	return 0;
}