#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(ll i=(a);i<(b);++i) #define per(i,a,b) for(ll i=(b-1);i>=(a);--i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define ctos(c) string(1,c) #define print(x) cout<<#x<<" = "<> s; return s; } long long ston(string s){ long long n; sscanf(s.c_str(), "%lld", &n); return n; } int main() { ll n; cin>>n; ll a = n/1000000000LL; if(a==0){ cout<<0<=c){ flag = 1; } vector v; rep(i,1,10){ v.pb(i); } rep(i,1,10001){ string s1 = ntos(i); string s2 = ntos(i); reverse(all(s2)); string s3 = s1+s2; v.pb(ston(s3)); rep(j,0,10){ string s4 = ntos(j); v.pb(ston(s1+s4+s2)); } } ll ans = 0; rep(i,0,v.sz){ if(v[i]<=b)ans++; } if(flag==0)ans--; cout << ans << endl; return 0; }