#include // c #include // io #include #include #include #include // container #include #include #include #include #include #include // other #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; #define ALL(c) (begin(c)),(end(c)) #define REP(i,n) FOR(i,0,n) #define REPr(i,n) FORr(i,0,n) #define FOR(i,l,r) for(int i=(int)(l);i<(int)(r);++i) #define FORr(i,l,r) for(int i=(int)(r)-1;i>=(int)(l);--i) #define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it) #define IN(l,v,r) ((l)<=(v) && (v)<(r)) #define UNIQUE(v) v.erase(unique(ALL(v)),v.end()) //debug #define DUMP(x) cerr << #x << " = " << (x) #define LINE() cerr<< " (L" << __LINE__ << ")" class range { private: struct Iter{ int v; int operator*(){return v;} bool operator!=(Iter& itr) {return v < itr.v;} void operator++() {++v;} }; Iter i, n; public: range(int n) : i({0}), n({n}) {} range(int i, int n) : i({i}), n({n}) {} Iter& begin() {return i;} Iter& end() {return n;} }; //input template istream& operator >> (istream& is,pair& p){is>>p.first>>p.second;return is;} template istream& operator >> (istream& is,tuple& t){is >> get<0>(t);return is;} template istream& operator >> (istream& is,tuple& t){is >> get<0>(t) >> get<1>(t);return is;} template istream& operator >> (istream& is,tuple& t){is >>get<0>(t)>>get<1>(t)>>get<2>(t);return is;} template istream& operator >> (istream& is,tuple& t){is >> get<0>(t)>>get<1>(t)>>get<2>(t)>>get<3>(t);return is;} template istream& operator >> (istream& is, const tuple& t){is >> get<0>(t) >> get<1>(t) >> get<2>(t) >> get<3>(t) >> get<4>(t);return is;} template istream& operator >> (istream& is, const tuple& t){is >> get<0>(t) >> get<1>(t) >> get<2>(t) >> get<3>(t) >> get<4>(t) >> get<5>(t);return is;} template istream& operator >> (istream& is, const tuple& t){is >> get<0>(t) >> get<1>(t) >> get<2>(t) >> get<3>(t) >> get<4>(t) >> get<5>(t) >> get<6>(t);return is;} template istream& operator >> (istream& is,vector& as){REP(i,as.size())is >>as[i];return is;} //output template ostream& operator << (ostream& os, const set& ss){for(auto a:ss){if(a!=ss.begin())os<<" "; os< ostream& operator << (ostream& os, const pair& p){os< ostream& operator << (ostream& os, const map& m){bool isF=true;for(auto& p:m){if(!isF)os< ostream& operator << (ostream& os, const tuple& t){os << get<0>(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const tuple& t){os << get<0>(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t)<<" "<(t);return os;} template ostream& operator << (ostream& os, const vector& as){REP(i,as.size()){if(i!=0)os<<" "; os< ostream& operator << (ostream& os, const vector>& as){REP(i,as.size()){if(i!=0)os< T INF(){assert(false);}; template<> int INF(){return 1<<28;}; template<> ll INF(){return 1LL<<58;}; template<> double INF(){return 1e16;}; template<> long double INF(){return 1e16;}; template T EPS(){assert(false);}; template<> int EPS(){return 1;}; template<> ll EPS(){return 1LL;}; template<> double EPS(){return 1e-8;}; template<> long double EPS(){return 1e-8;}; template T pmod(T v,U M){return (v%M+M)%M;} ll gcd_positive(ll a,ll b) { return b == 0 ? a : gcd_positive(b,a%b); } ll gcd(ll a,ll b) { return gcd_positive(abs(a), abs(b)); } ll lcm(ll a,ll b){return a/gcd(a,b)*b;} class Main{ public: void run(){ ll A,B;cin >> A >> B; ll res = 0; // |1|2| if(A<= 1 and B >= 2) res ++; // |..12..| // 12 * 10^x + y // A <= ..12.. <= ..12.. <= B for(int x = 0;x<=15;x++){ ll lv = 0; { ll l = -1,r = 1LL<<55; while(r-l>1){ ll m = (l+r)/2; ll d = m/(ll)pow(10,x); ll md = m%(ll)pow(10,x); // cerr << m <<" " << (100*d+12) << endl; if(A<=(100*d+12)*pow(10,x)+md){ r = m; }else{ l = m; } } lv = r; } ll rv = 0; { ll l = -1,r = 1LL<<55; while(r-l>1){ ll m = (l+r)/2; ll d = m/(ll)pow(10,x); ll md = m%(ll)pow(10,x); if((100*d+12)*pow(10,x)+md<=B){ l = m; }else{ r = m; } } rv = l; } // cerr << x <<" " << rv - lv + 1 <<" " << lv <<" " << rv << endl; res += rv - lv + 1; } // 0|2....1|2...2| for(int x = 0;x<=15;x++){ ll lv = 0; { ll l = -1,r = pow(10,x); while(r-l>1){ ll m = (l+r)/2; if(A<=2*pow(10,x+1)+ m*10+1){ r = m; }else{ l = m; } } lv = r; } ll rv = 0; { ll l = -1,r = pow(10,x); while(r-l>1){ ll m = (l+r)/2; if(2*pow(10,x+1)+m*10+1<=B-1){ l = m; }else{ r = m; } } rv = l; } // cerr << x <<" " << rv - lv + 1 <<" " << lv <<" " << rv << endl; res += rv - lv + 1; } cout << res << endl; } }; int main(){ cout <