#include<iostream>
using namespace std;
int main() {
int ansx=0;
int left,right;
cin>>left>>right;
while(left<right) {
int k=1;
int gcc11=left;
while(gcc11>0) {
int gcc98=gcc11/k%10;
if(gcc98==2) {
ansx++;
}
gcc11/=k;
k*=10;
}
left++;
}
cout<<ansx;
return 0;
}