#include<bits/stdc++.h>
#include<string>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long;
//auto test

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;
typedef long long ll;
typedef pair<ll ,ll> pll;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define REP(i,x,y) for(ll i = x;i <= y;++i)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z))
        ;
    return res;
}
void debug_out(vector<string> args, int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
void localTest() {
    #ifndef ONLINE_JUDGE
        freopen("inp", "r", stdin);
        freopen("out", "w", stdout);
    #endif      
}
void solver() {
    ll n, cnt = 0;
    cin >> n;
    for(ll i = 1; i <= min((ll)1e6, n); ++i) {
        string s = to_string(i);
        s += s;
        if(stoll(s) <= n) {
            ++cnt;
        }
    }
    cout << cnt << "\n";
    return;
}
int main() {

    localTest();
    fastio;
    int t = 1;
    // cin >> t;
    while(t--) {
        solver();
    }

    return 0;
}