#include <iostream>
using namespace std;
int main()
{
int l, r;
cin >> l >> r;
int ans = 0;
for (int i = l; i <= r; i++)
{
int m = i;
while (m)
{
if (m % 10 == 2)
ans++;
m /= 10;
}
}
cout << ans;
return 0;
}