#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = numeric_limits< int >::max()/3;

ll dp[20];

ll s_to_l(string s){
  stringstream ss;
  ll res;
  ss << s;
  ss >> res;
  return res;
}

string l_to_s(ll s){
  stringstream ss;
  string res;
  ss << s;
  ss >> res;
  return res;
}

ll count(string s){
  int size = (int)s.size();
  ll res = 0;
  if(size == 1){
    if(s[0] >= '2')return 1;
    else return 0;
  }else if(size == 2){
    if(s_to_l(s) >= 22)return 3;
    else if(s_to_l(s) >= 12)return 2;
    else return 1;
  }
  res += 1;
  for(int i = 0;i < size-2;++i){
    res += (ll)pow(10,i);
  }
  if(s[0]-'0' > 3){
    res += (ll)pow(10,size-2);
  }else if(s[0]-'0' == 2 &&
	   s[size-1]-'0' >= 2){
    res += s_to_l(s.substr(1,size-2))+1;
  }else if(s[0]-'0' == 2){
    res += s_to_l(s.substr(1,size-2));
  }
  if(s_to_l(s.substr(size-2,2)) >= 12)dp[2] = 1;
  else dp[2] = 0;
  for(int i = 3;i <= size;++i){
    dp[i] = (ll)pow(10,i-3)*(i-2)*(s[size-i] - '0');
    dp[i] += dp[i-1];
    if(s_to_l(s.substr(size-i,2)) > 12){
      dp[i] += (ll)pow(10,i-2);
    }else if(s_to_l(s.substr(size-i,2)) == 12){
      dp[i] += s_to_l(s.substr(size-i+2,i-2))+1;
    }
  }
  /*
  for(int i = 2;i <= size;++i){
    cout << dp[i] << " ";
  }
  cout << endl;
  */
  return res + dp[size];
}

int main(void){
  ll s,t;
  cin >> s >> t;
  --s;
  string sstr = l_to_s(s),tstr = l_to_s(t);
  ll res = count(tstr)-count(sstr);
  if(sstr == "1")--res;
  if(sstr[(int)sstr.size()-1] == '1' &&
     sstr[0] == '2')--res;
  cout << res << endl;
}