#include <bits/stdc++.h>
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define forx(i,x,n) for(int i=x;i<(int)n;i++)
#define ce(e,i,n) cout<<e<<" \n"[i==(int)n-1];
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N=5e2+2;
int a[N][N],vis[N][N],dr[4]={1,0,-1,0},dc[4]={0,1,0,-1},n,m;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//   = 0 -  [i] {} '\n'  p  _  ? ^
	string s;
	cin>>s;
	forn(i,s.size()){
		if(s[i]=='.')break;
		else cout<<s[i];
	}
}
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    unsigned long long int N;
    cin>>N;
    unsigned long long int minans=2100000000000000000;
    unsigned long long int rui2=1;
    for(int i=0;i<64;i++){
        minans=min(minans,N/rui2+i+(rui2-1&N));
        rui2*=2;
    }
    cout<<minans<<endl;
    return 0;
}
