#include #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) FOR(i,0,n) #define repr(i,n) for(int i=(n)-1;0<=i;--i) #define each(e,v) for(auto&& e:(v)) #define DUMP(x) cerr<<#x<<": "<<(x)<; using vdouble = vector; using vstring = vector; using ll = long long; template void chmin(T& a, const T& b) { a = min(a, b); } template void chmax(T& a, const T& b) { a = max(a, b); } constexpr ll M = 1e9 + 1; bool isPalindrome(string str) { const int s = str.size(); rep(i, s/2) { if(str[i] != str[s-i-1]) return false; } return true; } int main() { ll n; cin >> n; int cnt = 0; for(ll a = M; a <= n; a += M) { if(isPalindrome(to_string(a))) cnt++; } cout << cnt << endl; return 0; }