#include <stdio.h>

int num2(int L, int R) {
    int cnt = 0;
    for (int i = L; i <= R; i++) {
        int tmp = i;
        while (tmp) {
            if (tmp % 10 == 2)
                cnt++;
            tmp /= 10;
        }
    }
    return cnt;
}

int main() {
    int L, R;
    scanf("%d %d", &L, &R);
    printf("%d", num2(L, R));
    return 0;
}