#include <iostream>
#include <string>
using namespace std;
using ll = long long;
int main() {
    ll N;
    cin >> N;
    for (ll i = 1; ; i++) if (stoll(to_string(i) + to_string(i)) > N) {
        cout << i - 1 << endl;
        return 0;
    }
}
#include <bits/stdc++.h>
using namespace std;

int main() {

    long long n;
    scanf("%lld", &n);

    int ans = 0;

    for(int i = 1; ; i++) {

        string s = to_string(i);

        s += s;

        if(stoll(s) <= n) {
            ans++;
        }
        else break;
    }

    printf("%d\n", ans);
}

