// Src : Vux2Code
/* Note :
*/
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
// template <typename T> void vout(T s){ cout << s << endl; exit(0);}
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
const ll maxN = 2e5 + 5, maxLog = 20, inf64 = 1e18, inf32 = 1e9, mod = 1e9 + 7;
void maximize (ll &x, ll y) {x = max (x, y);}
void minimize (ll &x, ll y) {x = min (x, y);}
/* ---------HASHING-------- */
// const base = 31, mod2 = 1e9 + 9;
/* ---------BITMASK-------- */
// ll count (ll x) {return __builtin_popcountll (x);}
// ll fst (ll x) {return 63 - __builtin_clzll (x);}
// ll last (ll x) {return __builtin_ctzll (x);}
// bool bit (ll x, ll y) {return ((x >> y) & 1);}
ll t = 1;
ll a, b, ans;
void fk (ll pos, ll digit) {
if (digit > 15) return;
pos = pos * 10 + 7;
if (pos >= a && pos <= b) ans ++;
fk (pos, digit + 1);
pos /= 10;
pos = pos * 10 + 9;
if (pos >= a && pos <= b) ans ++;
fk (pos, digit + 1);
pos /= 10;
}
void solve () {
cin >> a >> b;
fk (0, 0);
cout << ans;
}
int main () {
ios::sync_with_stdio (0);
cin. tie (0);
cout. tie (0);
#define TASK "hoahong"
if (fopen (TASK".inp", "r")) {
freopen (TASK".inp", "r", stdin);
freopen (TASK".out", "w", stdout);
}
// cin >> t;
while (t --) solve ();
}
Ly8gU3JjIDogVnV4MkNvZGUKLyogTm90ZSA6CgoqLwoKI2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgovLyB0ZW1wbGF0ZSA8dHlwZW5hbWUgVD4gdm9pZCB2b3V0KFQgcyl7IGNvdXQgPDwgcyA8PCBlbmRsOyBleGl0KDApO30KCnR5cGVkZWYgbG9uZyBsb25nIGxsOwp0eXBlZGVmIGxvbmcgZG91YmxlIGxkOwp0eXBlZGVmIHBhaXIgP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