#include using namespace std; int main(){ long long N,ans=0; long long tmp,num,reverse; int k,l; cin >> N; N /= 1e9+1; for(int i=1;i<=N;i++){ num = i; reverse = 0; while(num > 0){ tmp = num%10; reverse = reverse*10+tmp; num /= 10; } if(reverse == i) ans++; } cout << ans << endl; return 0; }