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