#include<cstdio> #include<cstring> #include<algorithm> usingnamespace std; constint N = 12; int n[N], f[N][N]; voidinit() { for (int i = 0; i < 10; i++) f[1][i] = 1; for (int i = 2; i <= 10; i++) for (int j = 0; j < 10; j++) for (int k = 0; k < 10; k++) if (abs(j - k) >= 2) f[i][j] += f[i - 1][k]; } intsolve(int x) { memset(n, 0, sizeof n); int len = 0; while (x) { n[++len] = x % 10; x /= 10; } int res = 0; for (int i = 1; i < len; i++) for (int j = 1; j < 10; j++) res += f[i][j]; for (int i = 1; i < n[len]; i++) res += f[len][i]; for (int i = len - 1; i; i--) { for (int j = 0; j < n[i]; j++) if (abs(j - n[i + 1]) >= 2) res += f[i][j]; if (abs(n[i + 1] - n[i]) < 2) break; } return res; } intmain() { init(); int a, b; scanf("%d%d", &a, &b); printf("%d", solve(b + 1) - solve(a)); return0; }