#include <iostream>

using namespace std;

int main()
{
    int left;
    int right;
    cin >> left >> right;
    const int x = 2;
    int times = 0;
    for (int i = left; i <= right; i++) {
        int copy_i = i;
        while (copy_i != 0) {
            int ones_place = copy_i % 10;
            if (ones_place == x) {
                times++;
            }
            copy_i = copy_i / 10;
        }
    }
    cout << times;
    return 0;
}