#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0);
int main() 
{
    fastIO;
    ll n;
    cin>>n;
    ll i = 1;
    while(i) {
        ll temp = stoll(to_string(i) + to_string(i));
        if(temp > n) {
            cout<<i-1<<endl;
            break;
        }
        i++;
    }

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

int main() {
  long long n, c = 0;
  cin >> n ;
  for(int i = 1; stoll(to_string(i)+to_string(i)) <= n ; i++) c++;
  cout << c ;
}