#include <bits/stdc++.h>
using namespace std;

#ifdef loc
    #include "loc_debug.h"
#else
    #define pr(...)
    #define pra(a,n)
    #define praa(a,n,m)
    #define prl()
#endif

typedef long long ll;
typedef long double ld;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i, s, n)  for(int i = s; i <= n; ++i)
#define rev(i, n, s)  for(int i = n; i >= s; --i)
#define fore(x, a) for(auto &&x : a)
#define fill(a, x) memset((a), (x), sizeof(a))
#define tcase int __t; cin >> __t; rep(tc, 1, __t)
#define F first
#define S second
#define gc getchar

const int mod = 1000000007;
#define _ %mod
const int N = 100005;

vector<vector<int>> a;
bool canp[N];


bool can(vector<int> b) {
    int sum = 0;
    fore(x, b) {
        sum += x;
    }
    if(sum & 1) {
        return 0;
    }
    vector<bool> v(sum / 2 + 1, 0);
    v[0] = 1;
    fore(x, b) {
        rev(i, sum / 2, x) {
            v[i] = v[i] || v[i - x];
        }
    }
    return v[sum / 2];
}

void go(int sum, vector<int> b) {
    a.eb(b);
    if(sz(b) >= 10) {
        return;
    }
    rep(i, b.empty() ? 1 : b.back(), 9) {
        if(sum + i > 84) {
            break;
        }
        vector<int> c(b);
        c.eb(i);
        go(sum + i, c);
    }
}

int dp[11][2][N];
int b[11];
map<ll, int> lb;
int ns[N][10];

int dodp(int p, bool c, int w) {
    if(p == -1) {
        return canp[w];
    }
    int &res = dp[p][c][w];
    if(res == -1) {
        res = 0;
        rep(i, 0, 9) {
            if(c || (i <= b[p])) {
                res += dodp(p - 1, c || (i < b[p]), ns[w][i]);
            }
        }
    }
    return res;
}

int count(ll x) {
    fill(dp, -1);
    rep(i, 0, 10) {
        b[i] = int(x % 10);
        x /= 10;
    }
    int res = dodp(10, 0, 0);
    return res;
}

int main() {
    fast_io;
    go(0, vector<int>());
    sort(all(a));
    rep(i, 0, sz(a) - 1) {
        canp[i] = can(a[i]);
    }
    rev(i, sz(a) - 1, 0) {
        ll cur = 0;
        rep(j, 0, sz(a[i]) - 1) {
            cur = 10 * cur + a[i][j];
        }
        lb[cur] = i;
    }
    rep(i, 0, sz(a) - 1) {
        rep(k, 0, 9) {
            ll cur = 0;
            bool done = 0;
            if(k == 0) {
                done = 1;
            }
            rep(j, 0, sz(a[i]) - 1) {
                cur *= 10;
                if((!done) && k <= a[i][j]) {
                    cur += k;
                    cur *= 10;
                    done = 1;
                }
                cur += a[i][j];
            }
            if(!done) {
                cur = 10 * cur + k;
            }
            if(lb.find(cur) != lb.end()) {
                ns[i][k] = lb[cur];
            }
        }
    }
    while(true) {
        ll l, r;
        cin >> l >> r;
        if(l == 0 || r == 0) {
            break;
        }
        cout << count(r)  - count(l - 1) << endl;
    }
    return 0;
}
