#include <random>
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
string s = "";
for (int i = a; i <= b; ++i) {
s.append(to_string(i));
}
int ant = 0;
for (int j = 0; j < s.length(); ++j) {
if (s[j] == '2') {
ant++;
}
}
cout << ant;
}