#include<stdio.h>
int main() {
    int n, x, i, count = 0, t, m;
    scanf("%d%d", &i, &n);
    for (; i <= n; i++) {
        int j = i;
        while (j > 0) {
            t = j % 10;
            if (t == 2)
                count++;
            j = j / 10;
        }
    }
    printf("%d", count);
}