#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
#define INF 1e18+7
#define ll long long
#define tam 200
#define MOD 998244353
#define sqrtcomp 750

int main()
{
  ll n,x,y;
  string txt;
  cin>>n>>x>>y;
  cin>>txt;
  deque<ll> cola;
  cola.push_back(1);
  for (ll i = 1; i < txt.size(); ++i)
  {
    if (txt[i]!=txt[i-1])
      {

        cola.push_back(1);
      }

  }

  ll minn=1e18+7;
  ll totahora=0,num;
  //cout<<cola.size()<<endl;

    if (txt[0]=='1')
    {
      num=cola.size()/2;
      minn=min(totahora+num*y,minn);
    }
    else
    {
      num=cola.size()/2+cola.size()%2;
      minn=min(totahora+num*y,minn);
    }

  while(cola.size()>2)
  {
    totahora+=x;
    ll auxnum=cola.front();
    if (cola.size()<4)
    {
      cola.push_back(1);
    }
    cola.pop_front();
    cola.pop_front();
    if (txt[0]==1)
    {
      num=cola.size()/2;
      minn=min(totahora+num*y,minn);
    }
    else
    {
      num=cola.size()/2+cola.size()%2;
      minn=min(totahora+num*y,minn);
    }
  }
  //cout<<totahora<<" ";
  if (cola.size()==2)
  {
    minn=min(totahora+y,minn);
  }
  cout<<minn<<endl;
}


#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");

	int n, x, y;
	cin >> n >> x >> y;

	int start = -1;
	// length = 0;
	int zeroes = 0;

	int prev = -1;
	for(int i = 0; i < n; i++)
	{
		char in;
		cin >> in;
		int val = in - '0';

		if(val != prev)
		{
			prev = val;
			// length++;
			if(val == 0)
				zeroes++;

			if(start == -1)
				start = val;
		}
	}

	int ans;

	/*if(length % 2 == 0)
	{
		zeroes = length / 2;
	}
	else // odd length
	{
		if(start == 0)
		{
			zeroes = length / 2 + 1;
		}
		else
		{
			zeroes = length / 2;
		}
	}*/
	ans = min(zeroes * y, max(zeroes - 1, 0) * y + x);

	//if(zeroes == 1)
	//{
	//	ans = x;
	//}
	//if(zeroes == 0)
	//	ans = 0;

	cout << ans << endl;
}


#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");

	long long n, x, y;
	cin >> n >> x >> y;

	int start = -1;
	// length = 0;
	long long zeroes = 0;

	int prev = -1;
	for(int i = 0; i < n; i++)
	{
		char in;
		cin >> in;
		int val = in - '0';

		if(val != prev)
		{
			prev = val;
			// length++;
			if(val == 0)
				zeroes++;

			if(start == -1)
				start = val;
		}
	}

	long long ans;

	/*if(length % 2 == 0)
	{
		zeroes = length / 2;
	}
	else // odd length
	{
		if(start == 0)
		{
			zeroes = length / 2 + 1;
		}
		else
		{
			zeroes = length / 2;
		}
	}*/
	ans = min(zeroes * y, max(zeroes - 1, 0) * y + x);

	//if(zeroes == 1)
	//{
	//	ans = x;
	//}
	//if(zeroes == 0)
	//	ans = 0;

	cout << ans << endl;
}


#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");

	long long n, x, y;
	cin >> n >> x >> y;

	int start = -1;
	// length = 0;
	long long zeroes = 0;

	int prev = -1;
	for(int i = 0; i < n; i++)
	{
		char in;
		cin >> in;
		int val = in - '0';

		if(val != prev)
		{
			prev = val;
			// length++;
			if(val == 0)
				zeroes++;

			if(start == -1)
				start = val;
		}
	}

	long long ans;

	/*if(length % 2 == 0)
	{
		zeroes = length / 2;
	}
	else // odd length
	{
		if(start == 0)
		{
			zeroes = length / 2 + 1;
		}
		else
		{
			zeroes = length / 2;
		}
	}*/
	ans = min(zeroes * y, max(zeroes - 1, (long long) 0) * y + x);

	//if(zeroes == 1)
	//{
	//	ans = x;
	//}
	//if(zeroes == 0)
	//	ans = 0;

	cout << ans << endl;
}


#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");

	int n, x, y;
	cin >> n >> x >> y;

	int start = -1, length = 0;

	int prev = -1;
	for(int i = 0; i < n; i++)
	{
		char in;
		cin >> in;
		int val = in - '0';

		if(val != prev)
		{
			prev = val;
			length++;

			if(start == -1)
				start = val;
		}
	}

	int ans;
	int zeroes;

	if(length % 2 == 0)
	{
		zeroes = length / 2;
	}
	else // odd length
	{
		if(start == 0)
		{
			zeroes = length / 2 + 1;
		}
		else
		{
			zeroes = length / 2;
		}
	}
	ans = min(zeroes * y, (zeroes - 1) * y + x);

	if(length == 1)
	{
		ans = (start == 1) ? 0 : x;
	}

	cout << ans << endl;
}


#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");

	long long n, x, y;
	cin >> n >> x >> y;

	int start = -1;
	// length = 0;
	long long zeroes = 0, ones = 0;

	int prev = -1;
	for(int i = 0; i < n; i++)
	{
		char in;
		cin >> in;
		int val = in - '0';

		if(val != prev)
		{
			prev = val;
			// length++;
			if(val == 0)
				zeroes++;
			if(val == 1)
				ones++;
		}
	}

	long long ans;
	/*if(length % 2 == 0)
	{
		zeroes = length / 2;
	}
	else // odd length
	{
		if(start == 0)
		{
			zeroes = length / 2 + 1;
		}
		else
		{
			zeroes = length / 2;
		}
	}*/
	ans = min(zeroes * y, max(zeroes - 1, (long long) 0) * x + y);
	//ans = min(ones * y + y,

	//if(zeroes == 1)
	//{
	//	ans = x;
	//}
	//if(zeroes == 0)
	//	ans = 0;

	cout << ans << endl;
}


#include <string>
#include <set>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <queue>
#include <map>
#include <typeinfo>
using namespace std;

#define PI 3.1415926535897932384626

int main(void)
{
	//ifstream fin("__.in");
	//ofstream fout("__.out");

	long long n, x, y;
	cin >> n >> x >> y;

	int start = -1;
	// length = 0;
	int zeroes = 0;

	int prev = -1;
	for(int i = 0; i < n; i++)
	{
		char in;
		cin >> in;
		int val = in - '0';

		if(val != prev)
		{
			prev = val;
			// length++;
			if(val == 0)
				zeroes++;

			if(start == -1)
				start = val;
		}
	}

	long long ans;

	/*if(length % 2 == 0)
	{
		zeroes = length / 2;
	}
	else // odd length
	{
		if(start == 0)
		{
			zeroes = length / 2 + 1;
		}
		else
		{
			zeroes = length / 2;
		}
	}*/
	ans = min(zeroes * y, max(zeroes - 1, 0) * y + x);

	//if(zeroes == 1)
	//{
	//	ans = x;
	//}
	//if(zeroes == 0)
	//	ans = 0;

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{

    ll i , j , k , n , x , y , a , b , c;
    string str;
    scanf("%lld %lld %lld",&n,&x,&y);
    cin >> str;

    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '0')break;
    }

    ll ans1 = 0 , ans2 = 0;
    bool now = 0;
    for( ; i < n ; i++)
    {
        if(str[i] == '1' && now)
        {
            while(i < n && str[i] == '1')i++;
            if(i == n)break;
            i--;
            ans1 += x;
            now = 0;
        }
        else if(str[i] == '1') now = 0;
        else
        {
            now = 1;
        }
    }
    ans1 += y;

    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '0')break;
    }

    now = 0;
    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '1')
        {
            if(now) ans2 += y;
            now = 0;
        }
        else
        {
            now = 1;
        }
    }
    if(now)ans2 += y;
    ll ans = min(ans1,ans2);
    printf("%lld\n",ans);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ll i , j , k , n , x , y , a , b , c;
    string str;
    scanf("%lld %lld %lld",&n,&x,&y);
    cin >> str;

    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '0')break;
    }

    ll ans1 = 0 , ans2 = 0;
    bool now = 0;
    for( ; i < n ; i++)
    {
        if(str[i] == '1' && now)
        {
            if(i == n-1)break;
            ans1 += x;
        }
        else if(str[i] == '1') now = 0;
        else
        {
            now = 1;
        }
    }
    ans1 += y;

    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '0')break;
    }

    now = 0;
    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '1')
        {
            if(now) ans2 += y;
            now = 0;
        }
        else
        {
            now = 1;
        }
    }
    if(now)ans2 += y;
    ll ans = min(ans1,ans2);
    printf("%lld\n",ans);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{

    ll i , j , k , n , x , y , a , b , c;
    string str;
    scanf("%lld %lld %lld",&n,&x,&y);
    cin >> str;

    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '0')break;
    }

    ll ans1 = 0 , ans2 = 0;
    bool now = 0;
    for( ; i < n ; i++)
    {
        if(str[i] == '1' && now)
        {
            if(i == n-1)break;
            ans1 += x;
            now = 0;
        }
        else if(str[i] == '1') now = 0;
        else
        {
            now = 1;
        }
    }
    ans1 += y;

    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '0')break;
    }

    now = 0;
    for(i = 0 ; i < n ; i++)
    {
        if(str[i] == '1')
        {
            if(now) ans2 += y;
            now = 0;
        }
        else
        {
            now = 1;
        }
    }
    if(now)ans2 += y;
    ll ans = min(ans1,ans2);
    printf("%lld\n",ans);

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
vector < int > v;
bool check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    sort(v.begin(),v.end());
    if(v[0]==v[v.size()-1])
    return true;
    else
    return false;
}
long long Generate(long long S)
{
    long long K=1;
    while(S!=0)
    {
        if(S/10==0)
        return K;
        K*=10;
        S/=10;
    }
}
int main()
{
    long long Answer=0,l,r;  cin>>l>>r;
    if(check(l))  Answer++;
    if(check(r))  Answer++;
    while(l!=r)
    {
        if(l+Generate(l)>r)
        {
            Answer+=r/10-l/10;
            break;
        }
        Generate(l)==1 ? Answer++ : Answer+=Generate(l)/10;
        l+=Generate(l);
    }
    cout<<Answer;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
vector < int > v;
bool check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    sort(v.begin(),v.end());
    if(v[0]==v[v.size()-1])
    return true;
    else
    return false;
}
long long Generate(long long S)
{
    long long K=1;
    while(S!=0)
    {
        if(S/10==0)
        return K;
        K*=10;
        S/=10;
    }
}
int Final_check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    if(v[0]>=v[v.size()-1])  return 1;
    else   return 0;
}
int main()
{
    long long Answer=0,l,r;  cin>>l>>r;
    while(l<r)
    {
        if(l+Generate(l)>r)
        {
            Answer+=Final_check(r);
            Answer+=(r-l)/10;
        }
        else
        Generate(l)==1 ? Answer++ : Answer+=Generate(l)/10;
        l+=Generate(l);
    }
    cout<<Answer;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
vector < int > v;
bool check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    sort(v.begin(),v.end());
    if(v[0]==v[v.size()-1])
    return true;
    else
    return false;
}
long long Generate(long long S)
{
    long long K=1;
    while(S!=0)
    {
        if(S/10==0)
        return K;
        K*=10;
        S/=10;
    }
}
int Final_check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    if(v[0]>=v[v.size()-1])  return 1;
    else   return 0;
}
int main()
{
    long long Answer=0,l,r;  cin>>l>>r;
    if(1<=l&&l<=9&&10<=r&&r<=1e18)  Answer--;
    Answer+=check(l);
    while(l!=r)
    {
        if(l+Generate(l)>r)
        {
            Answer+=Final_check(r);
            Answer+=(r-l)/10;
            break;
        }
        Generate(l)==1 ? Answer++ : Answer+=Generate(l)/10;
        l+=Generate(l);
    }
    cout<<Answer;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
vector < int > v;
int Final_check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    if(v[0]>=v[v.size()-1])  return 1;
    else   return 0;
}
long long solve(long long n)
{
    if(n<=9)
        return n;

    long long c=0;
    c=n/10+9;

    if(!Final_check(n))
        c--;
    return c;
}
int main()
{
    long long Answer=0,l,r;  cin>>l>>r;
    cout<<solve(r)-solve(l-1);
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
vector < int > v;
bool check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    sort(v.begin(),v.end());
    if(v[0]==v[v.size()-1])
    return true;
    else
    return false;
}
long long Generate(long long S)
{
    long long K=1;
    while(S!=0)
    {
        if(S/10==0)
        return K;
        K*=10;
        S/=10;
    }
}
int Final_check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    if(v[0]>v[v.size()-1])  return 1;
    else   return 0;
}
int main()
{
    long long Answer=0,l,r;  cin>>l>>r;
    if(1<=l&&l<=9&&10<=r&&r<=1e18)  Answer--;
    Answer+=check(l);
    while(l!=r)
    {
        if(l+Generate(l)>r)
        {
            Answer+=Final_check(r);
            Answer+=(r-l)/10;
            break;
        }
        Generate(l)==1 ? Answer++ : Answer+=Generate(l)/10;
        l+=Generate(l);
    }
    cout<<Answer;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;
vector < int > v;
bool check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    sort(v.begin(),v.end());
    if(v[0]==v[v.size()-1])
    return true;
    else
    return false;
}
long long Generate(long long S)
{
    long long K=1;
    while(S!=0)
    {
        if(S/10==0)
        return K;
        K*=10;
        S/=10;
    }
}
int Final_check(long long n)
{
    v.clear();
    while(n!=0)
    {
        v.push_back(n%10);
        n/=10;
    }
    if(v[0]>=v[v.size()-1])  return 1;
    else   return 0;
}
int main()
{
    long long Answer=0,l,r;  cin>>l>>r;
    if(1<=l&&l<=9&&10<=r&&r<=1e18)  Answer--;
    Answer+=check(l);
    Answer+=check(r);
    while(l!=r)
    {
        if(l+Generate(l)>r)
        {
            Answer+=Final_check(r);
            Answer+=(r-l)/10;
            break;
        }
        Generate(l)==1 ? Answer++ : Answer+=Generate(l)/10;
        l+=Generate(l);
    }
    cout<<Answer;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long

string s;
ll memo[20][2][10][10];

ll go(ll pos,ll par,ll f,ll l){
    if(pos==s.size()){
        if(f==l){
           // cout<<f<<endl;
            return 1;
        }
        return 0;
    }
    if(memo[pos][par][f][l]!=-1) return memo[pos][par][f][l];
    ll ans=0;
    bool flag=false;
    if(f==0) flag=true;
    if(par){
        for(ll i=0;i<s[pos]-'0';i++){
            if(flag)
            ans+=go(pos+1,0,i,i);
            else
            ans+=go(pos+1,0,f,i);
        }
        ll val=s[pos]-'0';
        if(flag){
        ans+=go(pos+1,1,val,val);
        }
        else{
        ans+=go(pos+1,1,f,val);
        }
    }
    else{
        for(ll i=0;i<10;i++){
            if(flag){
                ans+=go(pos+1,0,i,i);
            }
            else{
                ans+=go(pos+1,0,f,i);
            }
        }
    }
    return memo[pos][par][f][l] = ans;
}

int main(){

    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ll l,r;
    cin>>l>>r;
    s=to_string(r);
    memset(memo,-1,sizeof(memo));
    ll inc = go(0,1,0,0);
    l--;
    memset(memo,-1,sizeof(memo));
    ll ex;
    s=to_string(l);
    ex = go(0,1,0,0);
    cout<<inc-ex;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

string s;
ll memo[20][2][10][10];

ll go(ll pos,ll par,ll f,ll l){
    if(pos==s.size()){
        if(f==l){
           // cout<<f<<endl;
            return 1;
        }
        return 0;
    }
    if(memo[pos][par][f][l]!=-1) return memo[pos][par][f][l];
    ll ans=0;
    bool flag=false;
    if(f==0) flag=true;
    if(par){
        for(ll i=0;i<s[pos]-'0';i++){
            if(flag)
            ans+=go(pos+1,0,i,i);
            else
            ans+=go(pos+1,0,f,i);
        }
        ll val=s[pos]-'0';
        if(flag){
        ans+=go(pos+1,1,val,val);
        }
        else{
        ans+=go(pos+1,1,f,val);
        }
    }
    else{
        for(ll i=0;i<10;i++){
            if(flag){
                ans+=go(pos+1,0,i,i);
            }
            else{
                ans+=go(pos+1,0,f,i);
            }
        }
    }
    return memo[pos][par][f][l] = ans;
}

int main(){

    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ll l,r;
    cin>>l>>r;
    s=to_string(r);
    memset(memo,-1,sizeof(memo));
    ll inc = go(0,1,0,0);
    l--;
    memset(memo,-1,sizeof(memo));
    ll ex;
    s=to_string(l);
    ex = go(0,1,0,0);
    cout<<inc-ex;
    return 0;
}


#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,A,B) for(int i=A;i<=B;i++)
#define mod 1000000007
#define v1d vector<int>
#define v2d vector<vector<int>>
#define v1s vector<string>
#define vip vector<pair<int,int> >
#define v1s vector<string>
#define v2s vector<vector<string> >
#define vsp vector<pair<string,string> >

int fun(string s){
    int n=s.length();
    if(n==1){
        return 1+('9'-s[0]);
    }
    int ans=0;
    int N=n+1;
    if(s[0]>=s[n-1]){
        ans=0;
        bool f=false;
        for(int i=1;i<n-1;i++){f=true;
            ans+= ('9'-s[i])*pow(10,n-2-i);
        }//cout<<s<<" "<<ans<<endl;
        if(!f)ans=0;
        if(s[0]=='9')return ans+1;
        return ans+pow(10,n-2)*('9'-s[0])+1;
    }
    if(s[0]<s[n-1]){
        ans=0;
        bool f=false;
        for(int i=1;i<n-1;i++){f=true;
            ans+= ('9'-s[i])*pow(10,n-2-i);
        }//cout<<s<<" "<<ans<<endl;
        if(!f)ans=0;
        if(s[0]=='9')return ans;
        return ans+pow(10,n-2)*('9'-s[0]);
    }

    return ans;
}

int32_t main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    IOS;
    string l,r;cin>>l>>r;
    int n1= l.length(),n2=r.length();
    int ans=0;
    int i=n1+1,j=1;
    while(i<=n2){
        ans+= pow(10,i-2)*9;
        i++;
    }
    //cout<<ans<<endl;cout<<fun(l)<<" "<<fun(r)<<endl;
    ans+= fun(l)-fun(r);
    if(r[0]==r[n2-1])ans++;
    cout<<ans;

    return 0;
}


#include<bits/stdc++.h>
#define ll         long long int
#define ff         first
#define ss         second
#define pb         push_back
#define srt(v)     sort(v.begin(),v.end())
#define rsrt(v)    sort(v.rbegin(),v.rend())
#define mkp(a,b)   make_pair(a,b)
#define scf2(a,b)  scanf("%lld%lld",&a,&b)
#define scf(a)     scanf("%lld",&a)
#define pf(a)      printf("%lld\n",a)
#define maxn       500005
using namespace std;

ll solve(ll n)
{
    ll val = n , f , e , u = 0;

    if(val<10)return val;

    e = val%10;

    while(val>0)
    {
        f = val%10;

        val/=10;
    }

    //cout << e << " " << f << endl;

    if(f>e) u = 8 + (n/10);
    else u = 9 + (n/10);

    return u;
}

int main()
{
    ll a , b;
    cin >> a >> b;

    ll ans = solve(b) - solve(a - 1);

    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += r;
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }
    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 + fn - r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += r;
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }
    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 + fn - r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l - 1) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  collNumber(long long  n) {
    long long  kol = 0;
    while (n > 0) {
        n = n / 10;
        ++kol;
    }
    return kol;
}
long long check(long long n) {
    int kol = 0;
    int b = n % 10;
    n /= 10;
    while (n > 10) {
        if (n % 10 != 0)
            ++kol;
        n /= 10;
    }
    return kol;
}
int main() {
    long long  l, r;
    cin >> l >> r;
    long long  b = l;
    b = collNumber(b);
    long long  c = r;
    c = collNumber(c);
    long long f = r;
    f = check(f);
    long long  ans = 0;
    for (long long  i = b + 1; i < c; ++i)
        ans += ((pow(10, i - 2)) * 9);
    long long  fl = l / pow(10, b - 1);
    long long  ll = l % 10;
    long long  fr = r / pow(10, c - 1);
    long long  lr = r % 10;
    if (c < 2)
        ans += (10 - c);
    else
        ans += (pow(10, c - 2) * (fr - 1));
    if (b < 2)
        ans += (10 - l);
    else
        ans += (pow(10, b - 2) * (9 - fl));
    if ((lr >= fr || f > 0) && c != 1) {
        int d = r / 10;
        int k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        int z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        ans += z;
    }
    if (ll <= fl && b != 1) {
        int d = r / 10;
        int k = 1;
        while (d > 10) {
            k = k * (d % 10 + 1);
            d /= 10;
        }
        ans += k;
    }
    cout << ans << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += (r - 1);
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }
    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 - fn + r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    int l, r;
    cin >> l >> r;
    cout << solve(r) - solve (l) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += (r - 1);
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }

    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 - fn + r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r - 1) - solve(l - 1) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  collNumber(long long  n) {
    long long  kol = 0;
    while (n > 0) {
        n = n / 10;
        ++kol;
    }
    return kol;
}
long long check(long long n) {
    int kol = 0;
    int b = n % 10;
    n /= 10;
    while (n > 10) {
        if (n % 10 != 0)
            ++kol;
        n /= 10;
    }
    return kol;
}
int main() {
    long long  l, r;
    cin >> l >> r;
    if (l == r) {
        cout << 0;
        return 0;
    }
    long long  b = l;
    b = collNumber(b);
    long long  c = r;
    c = collNumber(c);
    long long f = r;
    f = check(f);
    long long  ans = 0;
    for (long long  i = b + 1; i < c; ++i)
        ans += ((pow(10, i - 2)) * 9);
    long long  fl = l / pow(10, b - 1);
    long long  ll = l % 10;
    long long  fr = r / pow(10, c - 1);
    long long  lr = r % 10;
    if (c < 2)
        ans += (10 - c);
    else
        ans += (pow(10, c - 2) * (fr - 1));
    if (b < 2)
        ans += (10 - l);
    else
        ans += (pow(10, b - 2) * (9 - fl));
    if ((lr >= fr || f > 0) && c != 1) {
        int d = r / 10;
        int k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        int z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        if (lr >= fr)
            ++ans;
        ans += z;
    }
    if (ll <= fl && b != 1) {
        int d = l / 10;
        int k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        int z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        ans += z;
    }
    cout << ans << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += r;
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }
    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 + fn - r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        string k;
        while (d > 9) {
            k = char(d % 10 + 48) + k;
            d = d / 10;
        }
        ll z = 0;
        for (int i = 0; i < k.size(); ++i)
            z = (z * 10) + (k[i] - '0');
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l - 1) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  collNumber(long long  n) {
    long long  kol = 0;
    while (n > 0) {
        n = n / 10;
        ++kol;
    }
    return kol;
}
int main() {
    long long  l, r;
    cin >> l >> r;
    long long  b = l;
    b = collNumber(b);
    long long  c = r;
    c = collNumber(c);
    long long  ans = 0;
    for (long long  i = b + 1; i < c; ++i)
        ans += ((pow(10, i - 2)) * 9);
    long long  fl = l / pow(10, b - 1);
    long long  ll = l % 10;
    long long  fr = r / pow(10, c - 1);
    long long  lr = r % 10;
    if (c < 2)
        ans += (10 - c);
    else
        ans += (pow(10, c - 2) * (fr - 1));
    if (b < 2)
        ans += (10 - l);
    else
        ans += (pow(10, b - 2) * (9 - fl));
    if (lr >= fr && c != 1) {
        int d = r / 10;
        int k = 1;
        while (d > 10) {
            k = k * (d % 10 + 1);
            d /= 10;
        }
        ans += k;
    }
    if (ll <= fl && b != 1) {
        int d = r / 10;
        int k = 1;
        while (d > 10) {
            k = k * (d % 10 + 1);
            d /= 10;
        }
        ans += k;
    }
    cout << ans << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += r;
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }

    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 - fn + r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l - 1) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += (r - 1);
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }
    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 + fn - r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l - 1) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += (r - 1);
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }

    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 - fn + r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l - 1) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += (r - 1);
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }
    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 + fn - r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += (r - 1);
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }

    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 - fn + r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  collNumber(long long  n) {
    long long  kol = 0;
    while (n > 0) {
        n = n / 10;
        ++kol;
    }
    return kol;
}
int main() {
    long long  l, r;
    cin >> l >> r;
    long long  b = l;
    b = collNumber(b);
    long long  c = r;
    c = collNumber(c);
    long long  ans = 0;
    for (long long  i = b; i < c; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += ((pow(10, i - 2)) * 9);
    }
    long long  fl = l / pow(10, b - 1);
    long long  ll = l % 10;
    long long  fr = r / pow(10, c - 1);
    long long  lr = r % 10;
    if (ll > fl) {
        if (b >= 2)
            ans -= ((pow(10, b - 2)) * fl);
        else
            ans -= (l - 1);
    }
    else {
        if (b > 2)
            ans -= ((pow(10, b - 2)) * (fl - 1));
        else
            ans -= (l - 1);
    }
    ans += (pow(10, c - 2) * (fr - 1));
    if (lr >= fr) {
        int d = r / 10;
        int k = 1;
        while (d > 10) {
            k = k * (d % 10 + 1);
            d /= 10;
        }
        ans += k;
    }
    cout << ans << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += (r - 1);
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }
    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 - fn + r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        ll k = 0;
        while (d > 9) {
            k = k * 10 + d % 10;
            d = d / 10;
        }
        ll z = 0;
        while(k > 0) {
            z = z * 10 + k % 10;
            k /= 10;
        }
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve (l) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  collNumber(long long  n) {
    long long  kol = 0;
    while (n > 0) {
        n = n / 10;
        ++kol;
    }
    return kol;
}
long long check(long long n) {
    int kol = 0;
    int b = n % 10;
    n /= 10;
    while (n > 10) {
        if (n % 10 != 0)
            ++kol;
        n /= 10;
    }
    return kol;
}
int main() {
    long long  l, r;
    cin >> l >> r;
    long long  b = l;
    b = collNumber(b);
    long long  c = r;
    c = collNumber(c);
    long long f = r;
    f = check(f);
    long long  ans = 0;
    for (long long  i = b + 1; i < c; ++i)
        ans += ((pow(10, i - 2)) * 9);
    long long  fl = l / pow(10, b - 1);
    long long  ll = l % 10;
    long long  fr = r / pow(10, c - 1);
    long long  lr = r % 10;
    if (c < 2)
        ans += (10 - c);
    else
        ans += (pow(10, c - 2) * (fr - 1));
    if (b < 2)
        ans += (10 - l);
    else
        ans += (pow(10, b - 2) * (9 - fl));
    if ((lr >= fr || f > 0) && c != 1) {
        int d = r / 10;
        int k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        int z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        if (z == 0)
            ++ans;
        ans += z;
    }
    if (ll <= fl && b != 1) {
        int d = l / 10;
        int k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        int z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        if (z == 0)
            ++ans;
        ans += z;
    }
    cout << ans << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll NumberCount(ll r) {
    ll k = 0;
    while (r > 0) {
        ++k;
        r /= 10;
    }
    return k;
}
ll solve(ll r) {
    ll l = r;
    l = NumberCount(l);
    ll ans = 0;
    for (ll i = 1; i < l; ++i) {
        if (i == 1) {
            ans += 9;
            continue;
        }
        ans += (pow(10, i - 2) * 9);
    }
    ll fn = r / pow(10, l - 1);
    if (l >= 2)
        ans += (pow(10, l - 2) * (fn - 1));
    else
        ans += (r - 1);
    if (l == 2) {
        if (fn <= r % 10)
            ++ans;
    }
    if (l > 2 && (fn <= r % 10 || NumberCount(r - 10 + fn - r % 10) == l)) {
        if (fn > r % 10)
            r -= (10 - fn + r % 10);
        ll d = r / 10;
        string k;
        while (d > 9) {
            k = char(d % 10 + 48) + k;
            d = d / 10;
        }
        ll z = 0;
        for (int i = 0; i < k.size(); ++i)
            z = (z * 10) + (k[i] - '0');
        ans += (z + 1);
    }
    return ans;
}
int main() {
    ll l, r;
    cin >> l >> r;
    cout << solve(r) - solve(l) << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  collNumber(long long  n) {
    long long  kol = 0;
    while (n > 0) {
        n = n / 10;
        ++kol;
    }
    return kol;
}
long long check(long long n) {
    int kol = 0;
    int b = n % 10;
    n /= 10;
    while (n > 10) {
        if (n % 10 != 0)
            ++kol;
        n /= 10;
    }
    return kol;
}
int main() {
    long long  l, r;
    cin >> l >> r;
    if (l == r) {
        cout << 0;
        return 0;
    }
    long long  b = l;
    b = collNumber(b);
    long long  c = r;
    c = collNumber(c);
    long long f = r;
    f = check(f);
    long long  ans = 0;
    for (long long  i = b + 1; i < c; ++i)
        ans += ((pow(10, i - 2)) * 9);
    long long  fl = l / pow(10, b - 1);
    long long  ll = l % 10;
    long long  fr = r / pow(10, c - 1);
    long long  lr = r % 10;
    if (c < 2)
        ans += (10 - c);
    else
        ans += (pow(10, c - 2) * (fr - 1));
    if (b < 2)
        ans += (10 - l);
    else
        ans += (pow(10, b - 2) * (9 - fl));
    if ((lr >= fr || f > 0) && c != 1) {
        long long d = r / 10;
        long long k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        long long z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        if (lr >= fr)
            ++ans;
        ans += z;
    }
    if ((ll <= fl || r - l >= 10) && b != 1) {
        long long d = l / 10;
        long long k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        long long z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        ans += z;
    }
    cout << ans << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  collNumber(long long  n) {
    long long  kol = 0;
    while (n > 0) {
        n = n / 10;
        ++kol;
    }
    return kol;
}
long long check(long long n) {
    int kol = 0;
    int b = n % 10;
    n /= 10;
    while (n > 10) {
        if (n % 10 != 0)
            ++kol;
        n /= 10;
    }
    return kol;
}
int main() {
    long long  l, r;
    cin >> l >> r;
    long long  b = l;
    b = collNumber(b);
    long long  c = r;
    c = collNumber(c);
    long long f = r;
    f = check(f);
    long long  ans = 0;
    for (long long  i = b + 1; i < c; ++i)
        ans += ((pow(10, i - 2)) * 9);
    long long  fl = l / pow(10, b - 1);
    long long  ll = l % 10;
    long long  fr = r / pow(10, c - 1);
    long long  lr = r % 10;
    if (c < 2)
        ans += (10 - c);
    else
        ans += (pow(10, c - 2) * (fr - 1));
    if (b < 2)
        ans += (10 - l);
    else
        ans += (pow(10, b - 2) * (9 - fl));
    if ((lr >= fr || f > 0) && c != 1) {
        int d = r / 10;
        int k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        int z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        if (lr >= fr)
            ++ans;
        ans += z;
    }
    if (ll <= fl && b != 1) {
        int d = l / 10;
        int k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        int z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        ans += z;
    }
    cout << ans << '\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long  collNumber(long long  n) {
    long long  kol = 0;
    while (n > 0) {
        n = n / 10;
        ++kol;
    }
    return kol;
}
long long check(long long n) {
    int kol = 0;
    int b = n % 10;
    n /= 10;
    while (n > 10) {
        if (n % 10 != 0)
            ++kol;
        n /= 10;
    }
    return kol;
}
int main() {
    long long  l, r;
    cin >> l >> r;
    if (l == r) {
        cout << 0;
        return 0;
    }
    long long  b = l;
    b = collNumber(b);
    long long  c = r;
    c = collNumber(c);
    long long f = r;
    f = check(f);
    long long  ans = 0;
    for (long long  i = b + 1; i < c; ++i)
        ans += ((pow(10, i - 2)) * 9);
    long long  fl = l / pow(10, b - 1);
    long long  ll = l % 10;
    long long  fr = r / pow(10, c - 1);
    long long  lr = r % 10;
    if (c < 2)
        ans += (10 - c);
    else
        ans += (pow(10, c - 2) * (fr - 1));
    if (b < 2)
        ans += (10 - l);
    else
        ans += (pow(10, b - 2) * (9 - fl));
    if ((lr >= fr || f > 0) && c != 1) {
        long long d = r / 10;
        long long k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        long long z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        if (lr >= fr)
            ++ans;
        ans += z;
    }
    if (ll <= fl && b != 1) {
        long long d = l / 10;
        long long k = 0;
        while (d > 10) {
            k = k * 10 + (d % 10);
            d /= 10;
        }
        long long z = 0;
        while(k > 0) {
            z = z * 10 + (k % 10);
            k /= 10;
        }
        ans += z;
    }
    cout << ans << '\n';
    return 0;
}


#include<iostream>
using namespace std;
 long long solve( long long x)
{
     long long ans=0,f,e,xx=x;
    if(x<10)return x;
    e=x%10;
    while(x)
    {
        f=x%10;
        x/=10;
    }
    if(f<=e)ans=9+xx/10;
    else ans=8+xx/10;
    return ans;
}
int main()
{
     long long a,b;
    cin>>a>>b;
    cout<<solve(b)-solve(a-1)<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define    int               long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int solve(int x){
    if(x<=10)    return x+1;
    int ans=10,y=x,c=0,j=1;
    while(y>0){
        j=y%10;
        y=y/10;
        c++;
    }
    f(i,2,c-1)  ans+=9*pow(10,i-2);
    ans+=(j-1)*pow(10,c-2);
    y=pow(10,c-1);
    x=x%y;     ans+=x/10;
    if(x%10 >=j )    ans++;

    return ans;
}
int32_t main()
{
    fast
    int l,r;    cin>>l>>r;
    cout<<solve(r)-solve(l-1);
}


#include <bits/stdc++.h>
using namespace std;

#define    int               long long int
 #define    sp(x)                 setprecision(x)
#define    bp(x)           __builtin_popcount(x)
 #define  ld         long double
 #define  f(i,j,n)            for(int i = j; i <= n; i++)
#define  r(i,n,j)       for(int i = n; i >= j; i--)
 #define  all(container)       container.begin() , container.end()
#define  sz(container)   (int)container.size()
 #define  ff             first
#define  ss             second
 #define  pii      pair <int , int>
#define  sp(x)       setprecision(x)
 #define  endl    "\n"
#define  mod  1000000007
 #define  pb    push_back
#define  mp    make_pair
 #define  T     int ttt; cin >> ttt; while(ttt--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);

int power(int x, int y, int p)
{
    int res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int solve(int x){
    if(x<10)    return x;
    int ans=10,y=x,c=0,j=1;
    while(y>0){
        j=y%10;
        y=y/10;
        c++;
    }
    f(i,2,c-1)  ans+=9*pow(10,i-2);
    ans+=(j-1)*pow(10,c-2);
    y=pow(10,c-1);
    x=x%y;
    if(x>=j)    ans+= x/10;
    return ans;
}
int32_t main()
{
    fast
    int l,r;    cin>>l>>r;
    cout<<solve(r)-solve(l-1);
}


    //  ************************************************
    #include <iostream>
    using namespace std;

    long long int f(long long int n) {
        long long int r = 0;
        if (n < 10) r = n;
        else {
            r = n / 10 + 9;
            long long int first;
            int last = n % 10;
            while (n > 9) {
                n /= 10;
                first = n;
            }
            if (first < last) ++r;
        }
        return r;
    }

    int main() {
        long long int x, y;
        cin >> x >> y;
        cout << f(y+1) - f(x) << endl;
        return 0;
    }


#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ten[20];
int len(ll a)
{
    int sz=0;
    while(a>0)
        a/=10,sz++;
    return sz;
}
bool F_L(ll a)
{
    ll x,y;
    if(a/ten[len(a)]==a%10)
        return 1;
    return 0;
}
ll lower_part(ll l)
{
    if(len(l)<=2)
        return 1;
    ll x=l%10;
    for(int i=0; i<len(l)-2; i++)
        x*=10,x+=9;
    x*=10;
    x+=(l%10);
    return ((x-l)/10)+1;
}
ll upper_part(ll r)
{
    if(len(r)<=2)
        return 1;
    ll x=r%10;
    for(int i=0; i<len(r)-2; i++)
        x*=10;
    x*=10;
    x+=(r%10);
    return ((r-x)/10)+1;
}
ll lower_part2(ll l)
{
    ll x=0;
    for(int i=0; i<len(l); i++)
        x*=10,x+=9;
    x-=l;
    if(len(l)>1)
        x/=10;
    return x+1;
}
ll upper_part2(ll r)
{
    ll x=1;
    for(int i=0; i<len(r)-1; i++)
        x*=10;
    x+=1;
    r-=x;
    if(len(r)>1)
        r/=10;
    return r+1;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ten[1]=1;
    for(int i=2; i<=18; i++)
    {
        ten[i]=ten[i-1]*10;
    }
    ll l,r,base,sum=0;
    cin>>l>>r;
    if(len(l)==len(r))
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        if(l%10==r%10)
        {
            cout<<((r-l)/10)+1<<endl;
            return 0;
        }
        sum+=lower_part(l);
        sum+=upper_part(r);
        for(int i=(l%10)+1; i<=(r%10)-1; i++)
        {
            sum+=(ten[len(l)-1]);
        }
        cout<<sum<<endl;
    }
    else
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        sum+=lower_part2(l);
        sum+=upper_part2(r);
        for(int i=len(l)+1; i<len(r); i++)
        {
            for(int j=0; j<9; j++)
                sum+=ten[i-1];
        }
        cout<<sum<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ten[20];
int len(ll a)
{
    int sz=0;
    while(a>0)
        a/=10,sz++;
    return sz;
}
bool F_L(ll a)
{
    ll x,y;
    if(a/ten[len(a)]==a%10)
        return 1;
    return 0;
}
ll lower_part(ll l)
{
    if(len(l)<=2)
        return 1;
    ll x=l%10;
    for(int i=0; i<len(l)-2; i++)
        x*=10,x+=9;
    x*=10;
    x+=(l%10);
    return ((x-l)/10)+1;
}
ll upper_part(ll r)
{
    if(len(r)<=2)
        return 1;
    ll x=r%10;
    for(int i=0; i<len(r)-2; i++)
        x*=10;
    x*=10;
    x+=(r%10);
    return ((r-x)/10)+1;
}
ll lower_part2(ll l)
{
    ll x=0;
    for(int i=0; i<len(l); i++)
        x*=10,x+=9;
    x-=l;
    if(len(l)>1)
        x/=10;
    return x+1;
}
ll upper_part2(ll r)
{
    ll x=1;
    for(int i=0; i<len(r)-1; i++)
        x*=10;
    x+=1;
    r-=x;
    if(len(r)>1)
        r/=10;
    return r+1;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ten[1]=1;
    for(int i=2; i<=18; i++)
    {
        ten[i]=ten[i-1]*10;
    }
    ll l,r,base,sum=0;
    cin>>l>>r;
    if(len(l)==len(r))
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        if(l>r)
        {
            cout<<"0"<<endl;
            return 0;
        }
        if(l%10==r%10)
        {
            cout<<((r-l)/10)+1<<endl;
            return 0;
        }
        sum+=lower_part(l);
        sum+=upper_part(r);
        for(int i=(l%10)+1; i<=(r%10)-1; i++)
        {
            sum+=(ten[len(l)-1]);
        }
        cout<<sum<<endl;
    }
    else
    {
        ll x=r;
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        sum+=lower_part2(l);
        if(len(r)==len(x))
        sum+=upper_part2(r);
        for(int i=len(l)+1; i<len(r); i++)
        {
            for(int j=0; j<9; j++)
                sum+=ten[i-1];
        }
        cout<<sum<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ten[20];
int len(ll a)
{
    int sz=0;
    while(a>0)
        a/=10,sz++;
    return sz;
}
bool F_L(ll a)
{
    ll x,y;
    if(a/ten[len(a)]==a%10)
        return 1;
    return 0;
}
ll lower_part2(ll l)
{
    ll x=0;
    for(int i=0; i<len(l); i++)
        x*=10,x+=9;
    x-=l;
    if(len(l)>1)
        x/=10;
    return x+1;
}
ll upper_part2(ll r)
{
    ll x=1;
    for(int i=0; i<len(r)-1; i++)
        x*=10;
    x+=1;
    r-=x;
    if(len(r)>1)
        r/=10;
    return r+1;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ten[1]=1;
    for(int i=2; i<=19; i++)
    {
        ten[i]=ten[i-1]*10;
    }
    ll l,r,base,sum=0;
    cin>>l>>r;
    if(len(l)==len(r))
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        if(l>r)
        {
            cout<<"0"<<endl;
            return 0;
        }
        sum=r-l;
        if(len(l)!=1)
            sum/=2;
        cout<<sum+1<<endl;
    }
    else
    {
        ll x=r;
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        sum+=lower_part2(l);
        if(len(r)==len(x))
        sum+=upper_part2(r);
        for(int i=len(l)+1; i<len(x); i++)
        {
            for(int j=0; j<9; j++)
                sum+=ten[i-1];
        }
        cout<<sum<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ten[20];
int len(ll a)
{
    int sz=0;
    while(a>0)
        a/=10,sz++;
    return sz;
}
bool F_L(ll a)
{
    ll x,y;
    if(a/ten[len(a)]==a%10)
        return 1;
    return 0;
}
ll lower_part(ll l)
{
    if(len(l)<=2)
        return 1;
    ll x=l%10;
    for(int i=0; i<len(l)-2; i++)
        x*=10,x+=9;
    x*=10;
    x+=(l%10);
    return ((x-l)/10)+1;
}
ll upper_part(ll r)
{
    if(len(r)<=2)
        return 1;
    ll x=r%10;
    for(int i=0; i<len(r)-2; i++)
        x*=10;
    x*=10;
    x+=(r%10);
    return ((r-x)/10)+1;
}
ll lower_part2(ll l)
{
    ll x=0;
    for(int i=0; i<len(l); i++)
        x*=10,x+=9;
    x-=l;
    if(len(l)>1)
        x/=10;
    return x+1;
}
ll upper_part2(ll r)
{
    ll x=1;
    for(int i=0; i<len(r)-1; i++)
        x*=10;
    x+=1;
    r-=x;
    if(len(r)>1)
        r/=10;
    return r+1;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ten[1]=1;
    for(int i=2; i<=18; i++)
    {
        ten[i]=ten[i-1]*10;
    }
    ll l,r,base,sum=0;
    cin>>l>>r;
    if(len(l)==len(r))
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        if(l>r)
        {
            cout<<"0"<<endl;
            return 0;
        }
        if(l%10==r%10)
        {
            cout<<((r-l)/10)+1<<endl;
            return 0;
        }
        sum+=lower_part(l);
        sum+=upper_part(r);
        for(int i=(l%10)+1; i<=(r%10)-1; i++)
        {
            sum+=(ten[len(l)-1]);
        }
        cout<<sum<<endl;
    }
    else
    {
        ll x=r;
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        sum+=lower_part2(l);
        if(len(r)==len(x))
        sum+=upper_part2(r);
        for(int i=len(l)+1; i<len(x); i++)
        {
            for(int j=0; j<9; j++)
                sum+=ten[i-1];
        }
        cout<<sum<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ten[20];
int len(ll a)
{
    int sz=0;
    while(a>0)
        a/=10,sz++;
    return sz;
}
bool F_L(ll a)
{
    ll x,y;
    if(a/ten[len(a)]==a%10)
        return 1;
    return 0;
}
ll lower_part2(ll l)
{
    ll x=0;
    for(int i=0; i<len(l); i++)
        x*=10,x+=9;
    x-=l;
    if(len(l)>1)
        x/=10;
    return x+1;
}
ll upper_part2(ll r)
{
    ll x=1;
    for(int i=0; i<len(r)-1; i++)
        x*=10;
    x+=1;
    r-=x;
    if(len(r)>1)
        r/=10;
    return r+1;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ten[1]=1;
    for(int i=2; i<=19; i++)
    {
        ten[i]=ten[i-1]*10;
    }
    ll l,r,base,sum=0;
    cin>>l>>r;
    if(len(l)==len(r))
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        if(l>r)
        {
            cout<<"0"<<endl;
            return 0;
        }
        sum=r-l;
        if(len(l)!=1)
            sum/=10;
        cout<<sum+1<<endl;
    }
    else
    {
        ll x=r;
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        sum+=lower_part2(l);
        if(len(r)==len(x))
        sum+=upper_part2(r);
        for(int i=len(l)+1; i<len(x); i++)
        {
            for(int j=0; j<9; j++)
                sum+=ten[i-1];
        }
        cout<<sum<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ten[20];
int len(ll a)
{
    int sz=0;
    while(a>0)
        a/=10,sz++;
    return sz;
}
bool F_L(ll a)
{
    ll x,y;
    if(a/ten[len(a)]==a%10)
        return 1;
    return 0;
}
ll lower_part(ll l)
{
    if(len(l)<=2)
        return 1;
    ll x=l%10;
    for(int i=0; i<len(l)-2; i++)
        x*=10,x+=9;
    x*=10;
    x+=(l%10);
    return ((x-l)/10)+1;
}
ll upper_part(ll r)
{
    if(len(r)<=2)
        return 1;
    ll x=r%10;
    for(int i=0; i<len(r)-2; i++)
        x*=10;
    x*=10;
    x+=(r%10);
    return ((r-x)/10)+1;
}
ll lower_part2(ll l)
{
    ll x=0;
    for(int i=0; i<len(l); i++)
        x*=10,x+=9;
    x-=l;
    if(len(l)>1)
        x/=10;
    return x+1;
}
ll upper_part2(ll r)
{
    ll x=1;
    for(int i=0; i<len(r)-1; i++)
        x*=10;
    x+=1;
    r-=x;
    if(len(r)>1)
        r/=10;
    return r+1;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ten[1]=1;
    for(int i=2; i<=19; i++)
    {
        ten[i]=ten[i-1]*10;
    }
    ll l,r,base,sum=0;
    cin>>l>>r;
    if(len(l)==len(r))
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        if(l>r)
        {
            cout<<"0"<<endl;
            return 0;
        }
        if(l%10==r%10)
        {
            cout<<((r-l)/10)+1<<endl;
            return 0;
        }
        sum+=lower_part(l);
        sum+=upper_part(r);
        for(int i=(l%10)+1; i<=(r%10)-1; i++)
        {
            sum+=(ten[len(l)-1]);
        }
        cout<<sum<<endl;
    }
    else
    {
        ll x=r;
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        sum+=lower_part2(l);
        if(len(r)==len(x))
        sum+=upper_part2(r);
        for(int i=len(l)+1; i<len(x); i++)
        {
            for(int j=0; j<9; j++)
                sum+=ten[i-1];
        }
        cout<<sum<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll ten[20];
int len(ll a)
{
    int sz=0;
    while(a>0)
        a/=10,sz++;
    return sz;
}
bool F_L(ll a)
{
    ll x,y;
    if(a/ten[len(a)]==a%10)
        return 1;
    return 0;
}
ll lower_part(ll l)
{
    if(len(l)<=2)
        return 1;
    ll x=l%10;
    for(int i=0; i<len(l)-2; i++)
        x*=10,x+=9;
    x*=10;
    x+=(l%10);
    return ((x-l)/10)+1;
}
ll upper_part(ll r)
{
    if(len(r)<=2)
        return 1;
    ll x=r%10;
    for(int i=0; i<len(r)-2; i++)
        x*=10;
    x*=10;
    x+=(r%10);
    return ((r-x)/10)+1;
}
ll lower_part2(ll l)
{
    ll x=0;
    for(int i=0; i<len(l); i++)
        x*=10,x+=9;
    x-=l;
    if(len(l)>1)
        x/=10;
    return x+1;
}
ll upper_part2(ll r)
{
    ll x=1;
    for(int i=0; i<len(r)-1; i++)
        x*=10;
    x+=1;
    r-=x;
    if(len(r)>1)
        r/=10;
    return r+1;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ten[1]=1;
    for(int i=2; i<=18; i++)
    {
        ten[i]=ten[i-1]*10;
    }
    ll l,r,base,sum=0;
    cin>>l>>r;
    if(len(l)==len(r))
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        if(l>r)
        {
            cout<<"0"<<endl;
            return 0;
        }
        if(l%10==r%10)
        {
            cout<<((r-l)/10)+1<<endl;
            return 0;
        }
        sum+=lower_part(l);
        sum+=upper_part(r);
        for(int i=(l%10)+1; i<=(r%10)-1; i++)
        {
            sum+=(ten[len(l)-1]);
        }
        cout<<sum<<endl;
    }
    else
    {
        while(!(F_L(l)))
            l++;
        while(!(F_L(r)))
            r--;
        sum+=lower_part2(l);
        sum+=upper_part2(r);
        for(int i=len(l)+1; i<len(r); i++)
        {
            for(int j=0; j<9; j++)
                sum+=ten[i-1];
        }
        cout<<sum<<endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
int convert(string s)
{
   reverse(s.begin(),s.end());
   int res=0;
   for(int i=0;i<(int)s.length();i++)
    res+=(s[i]-'0')*(int)powl(10,i);
   return res;
}
int solve(int n)
{
    if(n<10)
      return n;
    if(n<100)
    {
        int res=9;
        for(int i=11;i<=n;i++)
          if(i%10==i/10)
            res++;
        return res;
    }
    string s=to_string(n);
    int res=0;
    for(int i=1;i<s[0]-'0';i++)
    {
        res+=(int)powl(10,(int)s.length()-2);
    }
    res+=18;
    for(int i=3;i<(int)s.length();i++)
      res+=9*(int)powl(10,i-2);
    string ans;
    for(int i=1;i<(int)s.length()-1;i++)
      ans+=s[i];
    res+=convert(ans)+1;
    if(s[0]>s.back())
      res--;
    return res;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int l,r;
    cin>>l>>r;
    cout<<solve(r)-solve(l-1)<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
int countdigits(int n)
{
    int res=0;
    while(n!=0)
    {
         res++;
         n/=10;
    }
    return res;
}
int convert(string s)
{
     reverse(s.begin(),s.end());
     int res=0;
     for(int i=0;i<(int)s.length();i++)
      res+=(s[i]-'0')*(int)powl(10,i);
     return res;
}
signed main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   int l,r;
   cin>>l>>r;
   string L=to_string(l);
   string R=to_string(r);
   int res=0;
   int cntl=countdigits(l);
   int cntr=countdigits(r);
   for(int i=cntl+1;i<cntr;i++)
   {
         res+=9*(int)powl(10,i-2);
   }
   int larger=0;
   int smaller=0;
   if(l<=9)
   {
       larger+=10-l;
   }
  else if(l<=99)
   {
      for(int i=l;i<=99;i++)
      {
           if(i/10==i%10)
            larger++;
      }
   }
   else
   {
        int firstdigit=L[0]-'0';
        larger+=(9-firstdigit)*(int)powl(10,(int)L.length()-2);
        string middle;
        for(int i=1;i<(int)L.length()-1;i++)
          middle+=L[i];
        int Middle=convert(middle);
        Middle=(int)powl(10,(int)L.length()-2)-Middle;
        larger+=Middle;
        if(L[0]<L.back())
          larger--;
   }
   res+=larger;
   if(r<=9)
   {
       smaller+=r;
   }
   else if(r<=99)
   {
       for(int i=11;i<=r;i++)
       {
            if(i%10==i/10)
              smaller++;
       }
   }
   else
   {
        int firstdigit=R[0]-'0';
        smaller+=(firstdigit-1)*(int)powl(10,(int)R.length()-2);
        string middle;
        for(int i=1;i<(int)R.length()-1;i++)
          middle+=R[i];
        int Middle=convert(middle);
        smaller+=Middle+1;
        if(R[0]>R.back())
          smaller--;
   }
   res+=smaller;
   if(cntl!=cntr)
   {
       cout<<res<<endl;
       return 0;
   }
   l=r;
   L=R;
   if(l<=9)
   {
       larger-=10-l;
   }
  else if(l<=99)
   {
      for(int i=l;i<=99;i++)
      {
           if(i/10==i%10)
            larger--;
      }
   }
   else
   {
        int firstdigit=L[0]-'0';
        larger-=(9-firstdigit)*(int)powl(10,(int)L.length()-2);
        string middle;
        for(int i=1;i<(int)L.length()-1;i++)
          middle+=L[i];
        int Middle=convert(middle);
        Middle=(int)powl(10,(int)L.length()-2)-Middle;
        larger-=Middle;
        if(L[0]<L.back())
          larger++;
   }
   if(L[0]==L.back())
   larger++;
   cout<<larger<<endl;
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 998244353

/*ll binpow(ll a, ll b) {

    ll res=1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a*a);
        b >>= 1;
    }
    return res;
}
*/

/*
ll cal(ll c,ll k)
{
    ll res=fact[c];

    ll res1=((fact[k]%mod)*(fact[(c-k)]%mod))%mod;

    ll res0;
    res0=binpow(res1,mod-2,mod);
    return ((res*res0)%mod);
}*/

/*bool cmp(const pair<int,int> &a,
              const pair<int,int> &b)
{
    if(a.first==b.first)
    {
        return(a.second<b.second);
    }
    else
    {
        return (a.first<b.first);
    }
}*/

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll a,b;
    cin>>a>>b;
    a--;

    string l=to_string(a);
    string r=to_string(b);

    ll  ans1;
    if(l.length()==1)
    {
        ans1=a;
    }
    else
    {
        if(l[0]<=l[(l.length()-1)])
        {
            ans1=(a/10)+9;
        }
        else
        {
            ans1=(a/10)+8;
        }
    }
     ll  ans2;
     if(r.length()==1)
     {
         ans2=b;
     }
     else
     {
        if(r[0]<=r[(r.length()-1)])
        {
            ans2=(b/10)+9;
        }
        else
        {
            ans1=(b/10)+8;
        }
     }

   // cout<<ans2<<" "<<ans1<<endl;

    cout<<ans2-ans1<<endl;

	return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Read questions carefully.


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 998244353

/*ll binpow(ll a, ll b) {

    ll res=1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a*a);
        b >>= 1;
    }
    return res;
}
*/

/*
ll cal(ll c,ll k)
{
    ll res=fact[c];

    ll res1=((fact[k]%mod)*(fact[(c-k)]%mod))%mod;

    ll res0;
    res0=binpow(res1,mod-2,mod);
    return ((res*res0)%mod);
}*/

/*bool cmp(const pair<int,int> &a,
              const pair<int,int> &b)
{
    if(a.first==b.first)
    {
        return(a.second<b.second);
    }
    else
    {
        return (a.first<b.first);
    }
}*/

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string l,r;
    cin>>l>>r;

    ll a=l.length();
    ll b=r.length();

    if(a==b &&a!=1)
    {
        ll f=1;
        for(ll i=1;i<a-1;i++)
        {
            f*=((r[i]-l[i]+1));
        }
        ll p=l[0]-'0';
        if(l[a-1]>l[0])
        {
            p++;
        }

        ll q=r[0]-'0';
        if(r[b-1]<r[0])
        {
            q--;
        }

       // cout<<p<<" "<<q<<endl;

        f*=(q-p+1);
        if(r.length()==1)
        {
            cout<<0<<endl;
        }
        else
        {
        cout<<f<<endl;
        }
    }
    else
    {
        ll x=b;
        ll ans=0;

        if(r[0]=='1' && r[b-1]=='0')
        {
            x--;
        }
      if(a+1<b)
      {
        for(ll j=a+1;j<=x;j++)
        {
          //  cout<<j<<endl;
            ll f=1;
            if(j!=2 && j!=1)
            {
                for(ll i=a+1;i<j;i++)
                {
                    f*=10;
                }
            }

           f=f*9;
         //  cout<<"f"<<f<<endl;
           ans+=f;
        }
      }
     //   cout<<ans<<endl;

        ll p=l[0]-'0';

        if((l[a-1]-'0')>p)
        {
            p++;
        }
        ll g1=10-p;
       // cout<<"gg"<<g1<<endl;
        for(ll i=1;i<a-1;i++)
        {
            g1*=(11-(l[i]-'0'));
        }

        ll q=r[0]-'0';

        if((r[b-1]-'0')<q)
        {
            q--;
        }
        ll g2=q;
      //  cout<<"ggg"<<g2<<endl;
        for(ll i=1;i<b-1;i++)
        {
            g2*=((r[i]-'0')+1);
        }

    //  cout<<g1<<" "<<g2<<endl;
       if(r.length()==0)
       {
           cout<<0<<endl;
       }
       else
       {
        cout<<ans+g1+g2<<endl;
       }
    }

	return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Read questions carefully.


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 998244353

/*ll binpow(ll a, ll b) {

    ll res=1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a*a);
        b >>= 1;
    }
    return res;
}
*/

/*
ll cal(ll c,ll k)
{
    ll res=fact[c];

    ll res1=((fact[k]%mod)*(fact[(c-k)]%mod))%mod;

    ll res0;
    res0=binpow(res1,mod-2,mod);
    return ((res*res0)%mod);
}*/

/*bool cmp(const pair<int,int> &a,
              const pair<int,int> &b)
{
    if(a.first==b.first)
    {
        return(a.second<b.second);
    }
    else
    {
        return (a.first<b.first);
    }
}*/

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string l,r;
    cin>>l>>r;

    ll a=l.length();
    ll b=r.length();

    if(a==b &&a!=1)
    {
        ll f=1;
        for(ll i=1;i<a-1;i++)
        {
            f*=((r[i]-l[i]+1));
        }
        ll p=l[0]-'0';
        if(l[a-1]>l[0])
        {
            p++;
        }

        ll q=r[0]-'0';
        if(r[b-1]<r[0])
        {
            q--;
        }

       // cout<<p<<" "<<q<<endl;

        f*=(q-p+1);
        if(r.length()==1)
        {
            cout<<0<<endl;
        }
        else
        {
        cout<<f<<endl;
        }
    }
    else
    {
        ll x=b;
        ll ans=0;

      if(a+1<b)
      {
        for(ll j=a+1;j<x;j++)
        {
         //  cout<<j<<endl;
            ll f=1;

                for(ll i=1;i<j-1;i++)
                {
                    f*=10;
                }

           f=f*9;
         //  cout<<"f"<<f<<endl;
           ans+=f;
        }
      }
       // cout<<ans<<endl;

        ll p=l[0]-'0';

        if((l[a-1]-'0')>p)
        {
            p++;
        }
        ll g1=10-p;
       // cout<<"gg"<<g1<<endl;
        for(ll i=1;i<a-1;i++)
        {
            g1*=(11-(l[i]-'0'));
        }

        ll q=r[0]-'0';

        if((r[b-1]-'0')<q)
        {
            q--;
        }
        ll g2=q;
      //  cout<<"ggg"<<g2<<endl;
        for(ll i=1;i<b-1;i++)
        {
            g2*=((r[i]-'0')+1);
        }

    // cout<<g1<<" "<<g2<<endl;
       if(r.length()==0)
       {
           cout<<0<<endl;
       }
       else
       {
        cout<<ans+g1+g2<<endl;
       }
    }

	return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Read questions carefully.


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 998244353

/*ll binpow(ll a, ll b) {

    ll res=1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a*a);
        b >>= 1;
    }
    return res;
}
*/

/*
ll cal(ll c,ll k)
{
    ll res=fact[c];

    ll res1=((fact[k]%mod)*(fact[(c-k)]%mod))%mod;

    ll res0;
    res0=binpow(res1,mod-2,mod);
    return ((res*res0)%mod);
}*/

/*bool cmp(const pair<int,int> &a,
              const pair<int,int> &b)
{
    if(a.first==b.first)
    {
        return(a.second<b.second);
    }
    else
    {
        return (a.first<b.first);
    }
}*/

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string l,r;
    cin>>l>>r;

    ll a=l.length();
    ll b=r.length();

    if(a==b &&a!=1)
    {
        ll f=1;
        for(ll i=1;i<a-1;i++)
        {
            f*=((r[i]-l[i]+1));
        }
        ll p=l[0]-'0';
        if(l[a-1]>l[0])
        {
            p++;
        }

        ll q=r[0]-'0';
        if(r[b-1]<r[0])
        {
            q--;
        }

       // cout<<p<<" "<<q<<endl;

        f*=(q-p+1);
        if(r.length()==1)
        {
            cout<<0<<endl;
        }
        else
        {
        cout<<f<<endl;
        }
    }
    else
    {
        ll x=b-a-1;
        ll ans=0;

        for(ll j=1;j<=x;j++)
        {
           // cout<<j<<endl;
            ll f=1;
            for(ll i=0;i<j;i++)
            {
                f*=10;
            }

           f=f*9;
         //  cout<<"f"<<f<<endl;
           ans+=f;
        }
        ll p=l[0]-'0';

        if((l[a-1]-'0')>p)
        {
            p++;
        }
        ll g1=10-p;
       // cout<<"gg"<<g1<<endl;
        for(ll i=1;i<a-1;i++)
        {
            g1*=(11-(l[i]-'0'));
        }

        ll q=r[0]-'0';

        if((r[b-1]-'0')<q)
        {
            q--;
        }
        ll g2=q;
      //  cout<<"ggg"<<g2<<endl;
        for(ll i=1;i<b-1;i++)
        {
            g2*=((r[i]-'0')+1);
        }

       // cout<<g1<<" "<<g2<<endl;
       if(r.length()==0)
       {
           cout<<0<<endl;
       }
       else
       {
        cout<<ans+g1+g2<<endl;
       }
    }

	return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Read questions carefully.


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 998244353

/*ll binpow(ll a, ll b) {

    ll res=1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a*a);
        b >>= 1;
    }
    return res;
}
*/

/*
ll cal(ll c,ll k)
{
    ll res=fact[c];

    ll res1=((fact[k]%mod)*(fact[(c-k)]%mod))%mod;

    ll res0;
    res0=binpow(res1,mod-2,mod);
    return ((res*res0)%mod);
}*/

/*bool cmp(const pair<int,int> &a,
              const pair<int,int> &b)
{
    if(a.first==b.first)
    {
        return(a.second<b.second);
    }
    else
    {
        return (a.first<b.first);
    }
}*/

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll a,b;
    cin>>a>>b;
    a--;

    string l=to_string(a);
    string r=to_string(b);

    ll  ans1;
    if(l.length()==1)
    {
        ans1=a;
    }
    else
    {
        if(l[0]<=l[(l.length()-1)])
        {
            ans1=(a/10)+9;
        }
        else
        {
            ans1=(a/10)+8;
        }
    }
     ll  ans2;
     if(r.length()==1)
     {
         ans2=b;
     }
     else
     {
        if(r[0]<=r[(r.length()-1)])
        {
            ans2=(b/10)+9;
        }
        else
        {
            ans2=(b/10)+8;
        }
     }

   // cout<<ans2<<" "<<ans1<<endl;

    cout<<ans2-ans1<<endl;

	return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Read questions carefully.


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 998244353

/*ll binpow(ll a, ll b) {

    ll res=1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a*a);
        b >>= 1;
    }
    return res;
}
*/

/*
ll cal(ll c,ll k)
{
    ll res=fact[c];

    ll res1=((fact[k]%mod)*(fact[(c-k)]%mod))%mod;

    ll res0;
    res0=binpow(res1,mod-2,mod);
    return ((res*res0)%mod);
}*/

/*bool cmp(const pair<int,int> &a,
              const pair<int,int> &b)
{
    if(a.first==b.first)
    {
        return(a.second<b.second);
    }
    else
    {
        return (a.first<b.first);
    }
}*/

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string l,r;
    cin>>l>>r;

    ll a=l.length();
    ll b=r.length();

    if(a==b &&a!=1)
    {
        ll f=1;
        for(ll i=1;i<a-1;i++)
        {
            f*=((r[i]-l[i]+1));
        }
        ll p=l[0]-'0';
        if(l[a-1]>l[0])
        {
            p++;
        }

        ll q=r[0]-'0';
        if(r[b-1]<r[0])
        {
            q--;
        }

       // cout<<p<<" "<<q<<endl;

        f*=(q-p+1);
        if(r.length()==1)
        {
            cout<<0<<endl;
        }
        else
        {
        cout<<f<<endl;
        }
    }
    else
    {
        ll x=b;
        ll ans=0;

        if(r[0]=='1' && r[b-1]=='0')
        {
            x--;
        }

        for(ll j=a+1;j<=x;j++)
        {
          //  cout<<j<<endl;
            ll f=1;
            if(j!=2 && j!=1)
            {
                for(ll i=a+1;i<j;i++)
                {
                    f*=10;
                }
            }

           f=f*9;
         //  cout<<"f"<<f<<endl;
           ans+=f;
        }
     //   cout<<ans<<endl;

        ll p=l[0]-'0';

        if((l[a-1]-'0')>p)
        {
            p++;
        }
        ll g1=10-p;
       // cout<<"gg"<<g1<<endl;
        for(ll i=1;i<a-1;i++)
        {
            g1*=(11-(l[i]-'0'));
        }

        ll q=r[0]-'0';

        if((r[b-1]-'0')<q)
        {
            q--;
        }
        ll g2=q;
      //  cout<<"ggg"<<g2<<endl;
        for(ll i=1;i<b-1;i++)
        {
            g2*=((r[i]-'0')+1);
        }

    //  cout<<g1<<" "<<g2<<endl;
       if(r.length()==0)
       {
           cout<<0<<endl;
       }
       else
       {
        cout<<ans+g1+g2<<endl;
       }
    }

	return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Read questions carefully.


/**
 *    author        : Saurav Paul
 *    created       : August 31, 2020 10:04 AM
 *    Problem Name  : C - Interval
 *    Problem Limit : 2000 ms , 262 MB
 *    Problem Url   : https://codeforces.com/contest/205/problem/C
 *    @genarated by : ai-virtual-assistant
**/

#include<bits/stdc++.h>
using namespace std;

using ll = long long int ;

class TC{

    ll find_it(ll x){
        if(x < 10) return x ;

        ll rem = x / 10 ;
        ll ans = rem;
        ll reminder = x % 10 ;

        while(x >= 10) x/= 10 ;

        if(x > reminder) ans -- ;

        ans += 9 ;

        return ans ;

    }

    public :
    void solve(){
        ll l , r ;
        cin >> l >> r;
        ll x = find_it(l-1) ;
        ll y = find_it(r) ;

        cout << y - x << endl ;

    }
};

int main(){
    ios_base::sync_with_stdio(false);

    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        TC tc;
        tc.solve() ;
    }

    return 0 ;
}


#include <bits/stdc++.h>

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

long long get_ans (long long n) {
	int k = 0;
	long long res = 0;
	long long num = n;
	int firstdig = 0;
	while (num > 0) {
		++k;
		if (num < 10) firstdig = num;
		num /= 10;
	}
	for (int i = 1; i < k; ++i) {
		long long add = 9;
		for (int j = 0; j < i - 2; ++j) add *= 10;
		res += add;
	}
	long long add = 9;
	long long d = 1;
	for (int j = 0; j < k - 2; ++j) {
			add *= 10; d *= 10;
	}
	if (k < 3) add = 1;
	for (int i = 1; i < firstdig; ++i)
		res += add;

	if (k == 1) ++res;
	else if (k == 2 && n > firstdig * 10 + firstdig) ++res;
	else {
	long long l = 0;
	if (n < (int)(n / 10) * 10 + firstdig) --l;
	long long ins = n / 10;
	ins %= d;
	l += (ins + 1);
	res += l;
	}
	return res;
}

int main()
{
  IO;
	long long l, r; cin >> l >> r;
	cout << get_ans(r) - get_ans(l - 1) << endl;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

long long get_ans (long long n) {
    if (n == 0) return 0;
    else {
	int k = 0;
	long long res = 0;
	long long num = n;
	int firstdig = 0;
	while (num > 0) {
		++k;
		if (num < 10) firstdig = num;
		num /= 10;
	}
	for (int i = 1; i < k; ++i) {
		long long add = 9;
		for (int j = 0; j < i - 2; ++j) add *= 10;
		res += add;
	}
	long long add = 9;
	long long d = 1;
	for (int j = 0; j < k - 2; ++j) {
			add *= 10; d *= 10;
	}
	if (k < 3) add = 1;
	for (int i = 1; i < firstdig; ++i)
		res += add;

	if (k == 1) ++res;
	else if (k == 2 && n > firstdig * 10 + firstdig) ++res;
	else {
	long long l = 0;
	if (n < (int)(n / 10) * 10 + firstdig) --l;
	long long ins = n / 10;
	ins %= d;
	l += (ins + 1);
	res += l;
	}
	return res;
    }
}

int main()
{
  IO;
	long long l, r; cin >> l >> r;
	cout << get_ans(r) - get_ans(l - 1) << endl;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

long long get_ans (long long n) {
	if (n == 0) return 0;
	else {
	int k = 0;
	long long res = 0;
	long long num = n;
	int firstdig = 0;
	while (num > 0) {
		++k;
		if (num < 10) firstdig = num;
		num /= 10;
	}
	for (int i = 1; i < k; ++i) {
		long long add = 9;
		for (int j = 0; j < i - 2; ++j) add *= 10;
		res += add;
	}
	long long add = 1;
	for (int j = 0; j < k - 2; ++j) {
			add *= 10;
	}
	for (int i = 1; i < firstdig; ++i)
		res += add;

	if (k == 1) ++res;
	else if (k == 2 && n > firstdig * 10 + firstdig) ++res;
	else {
	long long l = 0;
	if (n < (int)(n / 10) * 10 + firstdig) --l;
	long long ins = n / 10;
	ins %= add;
	l += (ins + 1);
	res += l;
	}
	return res;
	}
}

int main()
{
  IO;
	long long l, r; cin >> l >> r;
	cout << get_ans(r) - get_ans(l - 1) << endl;

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

long long get_ans (long long n) {
	if (n == 0) return 0;
	else {
	int k = 0;
	long long res = 0;
	long long num = n;
	int firstdig = 0;
	while (num > 0) {
		++k;
		if (num < 10) firstdig = num;
		num /= 10;
	}
	for (int i = 1; i < k; ++i) {
		long long add = 9;
		for (int j = 0; j < i - 2; ++j) add *= 10;
		res += add;
	}
	long long add = 1;
	for (int j = 0; j < k - 2; ++j) {
			add *= 10;
	}
	for (int i = 1; i < firstdig; ++i)
		res += add;

	if (k == 1) ++res;
	else if (k == 2 && n > firstdig * 10 + firstdig) ++res;
	else {
	long long l = 0;
	if (n < (long long)(n / 10) * 10 + firstdig) --l;
	long long ins = n / 10;
	ins %= add;
	l += (ins + 1);
	res += l;
	}
	return res;
	}
}

int main()
{
  IO;
	long long l, r; cin >> l >> r;
	cout << get_ans(r) - get_ans(l - 1) << endl;

  return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <iomanip>
#define endl "\n"
#define debug(x) cout << #x << " : " << x << endl;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(0);
typedef long long ll;
using namespace std;

ll fastExp(ll base, ll exp)
{
	ll result = 1;
	while(exp)
	{
		if(exp % 2)
			result = result * base;
		base = base * base;
		exp /= 2;
	}

	return result;
}

ll numPos(ll maxDigit, ll len, string &s)
{
	ll count = 0;
	for(ll i = 1; i <= len; i ++)
	{
		for(ll j = 1; j <= 9; j ++)
		{
			if(i == len && j > maxDigit)
				continue;
			else if(i == 1)
				count ++;
			else if(i < len)
			{
				count += fastExp(10, i - 2);
			}
			else if(i == len && j < maxDigit)
			{
				count += fastExp(10, i - 2);
			}
			else if(i == len && j == maxDigit)
			{
				ll val = 0;
				if(len == 2)
				{
					if(s[len - 1] - '0' >= j)
						count += 1;
					continue;
				}

				string temp = s.substr(1, len - 2);
				val = stoll(temp);
				if(s[len - 1] - '0' >= j)
						val += 1;
				count += val;
			}
		}
	}
	return count;
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	ll left, right;
	cin >> left >> right;

	left -= 1;
	string l = to_string(left);
	string r = to_string(right);

	ll maxDigit = l[0] - '0';
	ll len = l.length();
	ll ansL = numPos(maxDigit, len, l);

	maxDigit = r[0] - '0';
	len = r.length();
	ll ansR = numPos(maxDigit, len, r);
	// debug(ansL);
	// debug(ansR);

	ll ans = ansR - ansL;
	cout << ans << endl;
}


#include <bits/stdc++.h>
#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(ll i=1; i<= n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define INF (1LL<<62)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
const double PI = atan(1)*4;
const int MAXN = 3e3+5;
const double EPS = 1e-9;
const int p1=97;
const int p2=67;
const int p3=71;
const int p4=101;

const int m = 1e8+7;

inline int add(int a, int b, const int& mod){
    a+=b;
    if(a>mod) a-=mod;
    return a;
}
inline int sbt(int a, int b, const int& mod){
    a-=b;
    if(a<0) a+=mod;
    return a;
}
inline int mul(int a, int b, const int& mod){
    a*=b;
    if(a>mod) a-=mod;
    return a;
}

string Sa,Sb;
ll a,b,ans;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<< setprecision(2)<< fixed;
    cin>>Sa>>Sb;
    if(Sa.size()==1){
        a=stoll(Sa);
    } else{
        if(Sa[Sa.size()-1]>=Sa[0]){
            ans--;
        }
        Sa[Sa.size()-1]='0';
        a=stoll(Sa);
    }
    if(Sb.size()==1){
            b=stoll(Sb);
    } else{
        if(Sb[Sb.size()-1]>=Sb[0]){
            ans++;
        }
        Sb[Sb.size()-1]='0';
        b=stoll(Sb);
    }
    if(a<10){
        ans+=(10-a);
        a=10;
    }
    if(b<10){
        ans-=(10-b);
        b=10;
    }
//    d(a);
//    d(b);
//    d(ans);
    ans+=(b-a)/10;
    cout<<ans<<el;

}


#include <bits/stdc++.h>
#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(ll i=1; i<= n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define INF (1LL<<62)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
const double PI = atan(1)*4;
const int MAXN = 3e3+5;
const double EPS = 1e-9;
const int p1=97;
const int p2=67;
const int p3=71;
const int p4=101;

const int m = 1e8+7;

inline int add(int a, int b, const int& mod){
    a+=b;
    if(a>mod) a-=mod;
    return a;
}
inline int sbt(int a, int b, const int& mod){
    a-=b;
    if(a<0) a+=mod;
    return a;
}
inline int mul(int a, int b, const int& mod){
    a*=b;
    if(a>mod) a-=mod;
    return a;
}

string Sa,Sb;
ll a,b,ans;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<< setprecision(2)<< fixed;
    cin>>Sa>>Sb;
    if(Sa.size()==1){
        a=stoi(Sa);
    } else{
        if(Sa[Sa.size()-1]>=Sa[0]){
            ans--;
        }
        Sa[Sa.size()-1]='0';
        a=stoi(Sa);
    }
    if(Sb.size()==1){
            b=stoi(Sb);
    } else{
        if(Sb[Sb.size()-1]>=Sb[0]){
            ans++;
        }
        Sb[Sb.size()-1]='0';
        b=stoi(Sb);
    }
    if(a<10){
        ans+=(10-a);
        a=10;
    }

    if(b<10){
        ans-=(10-b);
        b=10;
    }
//    d(a);
//    d(b);
//    d(ans);
    ans+=(b-a)/10;
    cout<<ans<<el;

}


#include <bits/stdc++.h>
#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(ll i=1; i<= n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define INF (1LL<<62)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
const double PI = atan(1)*4;
const int MAXN = 3e3+5;
const double EPS = 1e-9;
const int p1=97;
const int p2=67;
const int p3=71;
const int p4=101;

const int m = 1e8+7;

inline int add(int a, int b, const int& mod){
    a+=b;
    if(a>mod) a-=mod;
    return a;
}
inline int sbt(int a, int b, const int& mod){
    a-=b;
    if(a<0) a+=mod;
    return a;
}
inline int mul(int a, int b, const int& mod){
    a*=b;
    if(a>mod) a-=mod;
    return a;
}

string Sa,Sb;
ll a,b,ans;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<< setprecision(2)<< fixed;
    cin>>Sa>>Sb;
    if(Sa.size()==1){
        a=stoll(Sa);
        if(Sb.size()==1){
            b = stoll(Sb);
            cout<<b-a+1<<el;
            return 0;
        }
    } else{
        if(Sa[Sa.size()-1]>Sa[0]){
            ans--;
        }
        Sa[Sa.size()-1]='0';
        a=stoll(Sa);
    }
    if(Sb.size()==1){
            b=stoll(Sb);
    } else{
        if(Sb[Sb.size()-1]>=Sb[0]){
            ans++;
        }
        Sb[Sb.size()-1]='0';
        b=stoll(Sb);
    }
    if(a<10){
        ans+=(10-a);
        a=10;
    }
    if(b<10){
        ans-=(10-b);
        b=10;
    }
//    d(a);
//    d(b);
//    d(ans);
    ans+=(b-a)/10;
    cout<<ans<<el;

}


#include <bits/stdc++.h>
#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(ll i=1; i<= n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define INF (1LL<<62)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
const double PI = atan(1)*4;
const int MAXN = 3e3+5;
const double EPS = 1e-9;
const int p1=97;
const int p2=67;
const int p3=71;
const int p4=101;

const int m = 1e8+7;

inline int add(int a, int b, const int& mod){
    a+=b;
    if(a>mod) a-=mod;
    return a;
}
inline int sbt(int a, int b, const int& mod){
    a-=b;
    if(a<0) a+=mod;
    return a;
}
inline int mul(int a, int b, const int& mod){
    a*=b;
    if(a>mod) a-=mod;
    return a;
}

string Sa,Sb;
ll a,b,ans;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<< setprecision(2)<< fixed;
    cin>>Sa>>Sb;
    if(Sa.size()==1){
        a=stoll(Sa);
    } else{
        if(Sa[Sa.size()-1]>Sa[0]){
            ans--;
        }
        Sa[Sa.size()-1]='0';
        a=stoll(Sa);
    }
    if(Sb.size()==1){
            b=stoll(Sb);
    } else{
        if(Sb[Sb.size()-1]>=Sb[0]){
            ans++;
        }
        Sb[Sb.size()-1]='0';
        b=stoll(Sb);
    }
    if(a<10){
        ans+=(10-a);
        a=10;
    }
    if(b<10){
        ans-=(10-b);
        b=10;
    }
//    d(a);
//    d(b);
//    d(ans);
    ans+=(b-a)/10;
    cout<<ans<<el;

}


#include <bits/stdc++.h>
#define fi first
#define se second
#define forn(i,n) for(int i=0; i< (int)n; ++i)
#define for1(i,n) for(ll i=1; i<= n; ++i)
#define fore(i,l,r) for(int i=(int)l; i<= (int)r; ++i)
#define ford(i,n) for(int i=(int)(n) - 1; i>= 0; --i)
#define fored(i,r,l) for(int i=(int)r; i>= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout<< #x<< " " << x<<el
#define INF (1LL<<62)

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
const double PI = atan(1)*4;
const int MAXN = 3e3+5;
const double EPS = 1e-9;
const int p1=97;
const int p2=67;
const int p3=71;
const int p4=101;

const int m = 1e8+7;

inline int add(int a, int b, const int& mod){
    a+=b;
    if(a>mod) a-=mod;
    return a;
}
inline int sbt(int a, int b, const int& mod){
    a-=b;
    if(a<0) a+=mod;
    return a;
}
inline int mul(int a, int b, const int& mod){
    a*=b;
    if(a>mod) a-=mod;
    return a;
}

string Sa,Sb;
ll a,b,ans;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<< setprecision(2)<< fixed;
    cin>>Sa>>Sb;
    if(Sa.size()==1){
        a=stoll(Sa);
    } else{
        if(Sa[Sa.size()-1]>Sa[0]){
            ans--;
        }
        Sa[Sa.size()-1]='0';
        a=stoll(Sa);
    }
    if(Sb.size()==1){
            b=stoll(Sb);
    } else{
        if(Sb[Sb.size()-1]>=Sb[0]){
            ans++;
        }
        Sb[Sb.size()-1]='0';
        b=stoll(Sb);
    }
    if(a<10){
        ans+=(10-a);
        a=10;
    }
    if(b<10){
        ans-=(10-b);
        b=10;
    }
    d(a);
    d(b);
    d(ans);
    ans+=(b-a)/10;
    cout<<ans<<el;

}