#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int n,t;
string s;
cin >> n;
t = n;
s = to_string(n);
do{
t /= 2;
s += to_string(t);
} while (t != 0);
cout << s.length() - 1 << endl;
return 0;
}