#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <queue>
#define rep(i, l, r) for(int i = l; i <= r; i++)
#define down(i, l, r) for(int i = l; i >= r; i--)
#define MS 12
#define MAX 1037471823
#define Q 103
using namespace std;
int n, s[MS], a, ans, m[MS][MS];
int main()
{
rep(i, 0, 9) m[0][i] = 1;
rep(i, 1, 10) rep(j, 0, 9) rep(k, 0, 9) if (abs(j-k) > 1) m[i][j] += m[i-1][k];
rep(i, 0, 10) rep(j, 1, 9) m[i][10] += m[i][j];
rep(i, 1, 10) m[i][10] += m[i-1][10];
rep(i, 0, 10) s[i] = MAX;
scanf("%d", &n); n -= 1; a = -1;
while (n > 0) s[++a] = n % 10, n /= 10;
if (a > 0) ans += m[a-1][10];
if (a >= 0) ans -= m[a][0];
down(i, a, 0)
{
rep(j, 0, s[i]-1)
if (abs(j-s[i+1]) > 1) ans += m[i][j];
if (abs(s[i]-s[i+1]) <= 1) break;
if (i == 0) ans += m[0][s[0]];
}
ans *= -1;
rep(i, 0, 10) s[i] = MAX;
scanf("%d", &n); a = -1;
while (n > 0) s[++a] = n % 10, n /= 10;
if (a > 0) ans += m[a-1][10];
if (a >= 0) ans -= m[a][0];
down(i, a, 0)
{
rep(j, 0, s[i]-1)
if (abs(j-s[i+1]) > 1) ans += m[i][j];
if (abs(s[i]-s[i+1]) <= 1) break;
if (i == 0) ans += m[0][s[0]];
}
printf("%d\n", ans);
return 0;
}
I2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxxdWV1ZT4KCiNkZWZpbmUgcmVwKGksIGwsIHIpIGZvcihpbnQgaSA9IGw7IGkgPD0gcjsga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