#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using ll = long long;
using namespace std;
string str(int n) {
    ostringstream oss;
    oss << n;
    return oss.str();
}
int main() {
    ll n; cin >> n;
    int k = n / 1000000001;
    int cnt = 0;
    repeat_from (i, 1, k+1) {
        string s = str(i);
        string t = s; whole(reverse, t);
        if (s == t) ++ cnt;
    }
    cout << cnt << endl;
    return 0;
}