#include using namespace std; #define FOR(i, j, k) for(int i = j; i < k; ++i) #define rep(i, j) FOR(i, 0, j) #define repr(i, j) for(int i = j; i >= 0; --i) #define INF (1 << 30) #define MOD 1e9 + 7 typedef long long ll; typedef unsigned long long ull; typedef pair P; int main() { ll N; scanf("%lld", &N); ll M = N / (1e9 + 1); int ans; ll tmp = 1e9 + 1; rep(i, M) { string num = to_string(tmp); bool flag = false; rep(i, num.size()/2) { if(num[i] == num[num.size() - i]) flag = true; else { break; flag = false; } } if(flag) ++ans; } printf("%lld\n", ans); return 0; }