#include <bits/stdc++.h>
using namespace std;

int main() {
  long long X;
  cin>>X;
  if(X/10000000000000>=1){
    if(X/10000000000000>10){
      cout<<10000000000000/10000001<<endl;
    }
    else{
      cout<<X/10000001<<endl;
    }
    cout<<X/10000001<<endl;
  }//33333333333333
   //1000000000000
  else if(X/100000000000>=1){
    if(X/100000000000>10){
      cout<<100000000000/1000001<<endl;
    }
    else{
      cout<<X/1000001<<endl;
    }
  }//333333333333
  else if(X/1000000000>=1){
    if(X/1000000000>10){
      cout<<10000000000/100001<<endl;
    }
    else{
      cout<<X/100001<<endl;
    }
  }//3333333333
  else if(X/10000000>=1){
    if(X/10000000>10){
      cout<<100000000/10001<<endl;
    }
    else{
      cout<<X/10001<<endl;
    }
  }//33333333
  else if(X/100000>1){
    if(X/100000>10){
      cout<<1000000/1001<<endl;
    }
    else{
      cout<<X/1001<<endl;
    }
  }//333333
  else if(X/1000>=1){
    if(X/1000>10){
      cout<<10000/101<<endl;
    }
    else{
      cout<<X/101<<endl;
    }
  }//3333
  else if(X/10>=1){
    if(X/10>10){
      cout<<100/11<<endl;
    }
    else{
      cout<<X/11<<endl;
    }
  }//33
  else{
    cout<<0<<endl;
  }
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;

ll func(ll i) {
    ll refact;
    string i_st = to_string(i);
    i_st += i_st;
    refact = stoll(i_st);
    return refact;
}
int main() {
    ll N;
    cin >> N;
    int i = 1;
    int ans = 0;
    while(func(i) <= N) {
        ans++;
        i++;
    }
    cout << ans << endl;
    
}