//丹阳新区实小路彦
#include <bits/stdc++.h>
using namespace std;
int main()
{
int l, r;
cin >> l >> r;
int res = 0;
for (int i = l; i <= r; i ++ )
for (int j = i; j; j /= 10)
if (j % 10 == 2) res++;
cout << res << endl;
return 0;
}