#include <stdio.h>

int main() {
    int L, R, count = 0;
    scanf("%d %d", &L, &R);
    for (int i = L; i <= R; i++) {
        int temp = i;
        while (temp) {
            if (temp % 10 == 2) {
                count++;
            }
            temp /= 10;
        }
    }
    printf("%d", count);
    return 0;
}