#32679: _ans


yp11151049@yphs.tp.edu.tw (901-26李文睿)


#include<bits/stdc++.h>
using namespace std;
int main(){
    int l,r;
    while(cin>>l>>r){
        int c=0;
        for(int i=l;i<=r;i++){
            int temp=i;
            while(temp!=0){
                if(temp%10==2) c++;
                temp/=10;
            }
        }
        cout<<c<<endl;
    }
    return 0;
}