#include <bits/stdc++.h>
using namespace std;
int n,h;
int hw(int s){
int ys=0;
while(s!=0){
ys=ys*10+s%10;
s=s/10;
}
return ys;
}
int main(){
cin>>n;
for(int i=1;i<=n;i++){
if(i==hw(i)){
h++;
}
}
cout<<h;
}
/**************************************************************
Problem: 1149
User: 15159808820
Language: C++
Result: Accepted
Time:14 ms
Memory:2072 kb
****************************************************************/