/*
1949:【10NOIP普及组】数字统计
http://ybt.ssoier.cn:8088/problem_show.php?pid=1949
*/
#include <bits/stdc++.h>
using namespace std;
int main( void )
{
int L,R,tmp,ans=0;
cin>>L>>R;
for(int i=L;i<=R;i++)
{
int tmp=i;
while( tmp )
{
if( tmp%10 == 2)
{
ans++;
}
tmp/=10;
}
}
cout<<ans<<endl;
return 0;
}
1949:【10NOIP普及组】数字统计