#include #define rep(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; int INF = (1LL << 30) - 1; ll num = 1000000001; int MOD = 1e9+7; string to_str(ll A){ stringstream ss; ss << A; return ss.str(); } main(){ ll N,cnt = 0; cin >> N; for(ll i = num;i <= N;i += num){ string S = to_str(i); bool flag = 1; rep(j,S.size()/2){ flag &= (S[j] == S[S.size() - j - 1]); } if(flag)cnt++; } cout << cnt << endl; }