#include <iostream>
using namespace std;
int main()
{
int n, m;
int p = 0, count = 0;
cin >> n >> m;
for (int i = n; i <= m; i++)
{
int n = i;
while (n != 0)
{
p = n % 10;
n = n / 10;
if (p == 2)
{
count++;
}
}
}
cout << count << endl;
return 0;
}
using namespace std;
int main()
{
int n, m;
int p = 0, count = 0;
cin >> n >> m;
for (int i = n; i <= m; i++)
{
int n = i;
while (n != 0)
{
p = n % 10;
n = n / 10;
if (p == 2)
{
count++;
}
}
}
cout << count << endl;
return 0;
}