#include using namespace std; int cnt; bool check(int x) { string s = to_string(x); string t = s; reverse(t.begin(), t.end()); if (s != t) return false; bool flag = false; for (int i = 0; i < s.size(); i++) if (s[i] == '7') flag = true; if (!flag) return false; return true; } int main() { int a, b; cin >> a >> b; for (int i = a; i <= b; i++) if (check(i)) cnt++; cout << cnt << endl; return 0; }