#include <stdio.h>

void count(int a, int b)
{
	int j, num, i;
	int cout = 0;
	for (j = a; j <= b; j++)
	{
		int val = j;
		while (val)
		{
			
			if ((val%10) == 2)
			{
				cout++;
			}
			val /= 10;
		}

	}
	printf("%d", cout);
}
int main()
{
	int l, r;
	scanf("%d%d", &l, &r);
	count(l, r);


	return 0;
}