#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const long long oo = 1 << 30;
const long long loo = 1ll << 62;
const long long mods = 1e9 + 7;
const long long MAXN = 5000005;
const long long INF = 0x3f3f3f3f;
inline long long read() {
  long long f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
long long num = 0, a[MAXN], cntl[10], cntr[10], cnt[10], L[20], R[20], ans = 0,
          l, r;
long long check(long long x) {
  cntl[0] = cntr[0] = 19;
  for (long long i = 1; i < 10; i++)
    cntl[i] = cntr[i] = cnt[i], cntl[0] -= cnt[i], cntr[0] -= cnt[i];
  long long Flag = 1;
  for (long long i = 0, flag = 0; i < 19; i++) {
    for (long long j = (flag ? 0 : L[i] + 1); j <= R[i] - 1; j++)
      if (cntr[j]) return 1;
    if (L[i] != R[i]) flag = 1;
    if ((--cntr[R[i]]) < 0) {
      Flag = 0;
      break;
    }
  }
  if (Flag) return 1;
  Flag = 1;
  for (long long i = 0, flag = 0; i < 19; i++) {
    for (long long j = L[i] + 1; j <= (flag ? 9 : R[i] - 1); j++)
      if (cntl[j]) return 1;
    if (L[i] != R[i]) flag = 1;
    if ((--cntl[L[i]]) < 0) {
      Flag = 0;
      break;
    }
  }
  return Flag;
  return Flag > 0;
}
void dfs(long long x, long long y) {
  if (x == 10) {
    ans += check(y);
    return;
  }
  for (;;) {
    dfs(x + 1, y);
    if (((long double)y) * 10 + x > 1e18) break;
    y = y * 10 + x;
    cnt[x]++;
  }
  cnt[x] = 0;
}
signed main() {
  long long l = read(), r = read(), t;
  t = l;
  for (long long i = 1; i <= 19; i++) L[19 - i] = t % 10, t /= 10;
  t = r;
  for (long long i = 1; i <= 19; i++) R[19 - i] = t % 10, t /= 10;
  dfs(1, 0);
  printf("%lld\n", ans);
  return 0;
}
