#include<iostream> using namespace std; int main() { long long a,b,q=0; cin>>a>>b; for(int p=0;p<=b;p++) { for(long long e=10;e<=1000000;e=e*10) if(p%e/(e/10)==a) q++; } cout<<q; return 0; }