#include<bits/stdc++.h> using namespace std; int main() { int a=0,b=0,sum=0,temp; cin>>a>>b; for (int c = a; c <= b; ++c) { temp = c; while(temp>=1) { if(temp%10==2) sum++; else temp/=10; } } cout<<sum; return 0; }