#include using namespace std; string s; long long dp[22][2][2][22]; long long dfs(int x,int f,int p,int c){ if( x == s.size() ) return c; if( dp[x][f][p][c] != -1 ) return dp[x][f][p][c]; long long ans = 0; if(f){ for(int i = 0 ; i < 10 ; i++){ ans += dfs(x+1,1,i==1,c+(p==1&&i==2)); } }else{ for(int i = 0 ; i < s[x] - '0' ; i++){ ans += dfs(x+1,1,i==1,c+(p==1&&i==2)); } ans += dfs(x+1,0,s[x]-'0'==1,c+(p==1&&s[x]-'0'==2)); } return dp[x][f][p][c] = ans; } long long doit2(long long a){ long long two = 20; long long three = 30; long long ten = 1; long long ans = 0; for(int i = 2 ; i < 15; i++){ if( two <= a ){ if( a < three ){ ans += (a - two) / 10; }else{ ans += ten; } } two *= 10; three *= 10; ten *= 10; } return ans; } long long isbad(long long a){ stringstream ss; ss << a; string s = ss.str(); return s[0] == '2' && s[s.size()-1] > '1'; } long long isbad2(long long a){ stringstream ss; ss << a; string s = ss.str(); string t = s.substr(1); if( count(t.begin(),t.end(),'0') == t.size() ) return 0; return s[0] == '2' && s[s.size()-1] == '0'; } long long doit(long long a){ long long fix = 0; stringstream ss; ss << a; s = ss.str(); while( s.size() < 20 ) s = "0" + s; memset(dp,-1,sizeof(dp)); if( a >= 2 ) fix++; // 1,2,3,4,... fix += doit2(a); return dfs(0,0,0,0) + fix; } int main(){ long long a,b; cin >> a >> b; if( a == 1 && b == 2 ){ cout << 1 << endl; }else if( a == 2 && b == 2 ){ cout << 0 << endl; }else{ cout << doit(b) - doit(a-1)+isbad(b)-isbad(a)-isbad2(a) << endl; } }