#include <bits/stdc++.h>
using namespace std;
int lenR, lenL, a[22], cnt, ans, ll[22];
unsigned long long L, R, p[22];
int b[22], b0[22];
void check() {
  cnt++;
  if (cnt == 1) return;
  for (register int i = 1; i <= 9; ++i) b[i] = 0;
  unsigned long long SSS = 0;
  for (register int i = 1; i <= lenR; ++i) {
    if (!a[i]) break;
    SSS = SSS * 10 + a[i];
    b[a[i]]++;
  }
  if (SSS > R) return;
  if (L <= SSS && SSS <= R) {
    ans++;
    return;
  }
  unsigned long long S = 0, S0;
  for (int i = lenR + 1; i; --i) {
    if (ll[i]) {
      if (b[ll[i]])
        --b[ll[i]];
      else
        break;
    }
    for (register int j = 1; j <= 9; ++j) b0[j] = b[j];
    S += p[i] * ll[i];
    S0 = S;
    bool flag = false;
    if (i - 1) {
      for (register int j = ll[i - 1] + 1; j <= 9; ++j)
        if (b0[j]) {
          b0[j]--, S0 += p[i - 1] * j, flag = true;
          break;
        }
      if (S0 > R) continue;
      if (flag) {
        int tmp = 9;
        for (register int j = 1; j < i - 1; ++j) {
          while (tmp && !b0[tmp]) --tmp;
          if (tmp)
            --b0[tmp];
          else
            break;
          S0 += p[j] * tmp;
        }
      }
    } else
      flag = true;
    if (flag)
      for (register int j = 1; j <= 9; ++j)
        if (b0[j]) flag = false;
    if (flag && S0 <= R) {
      ans++;
      return;
    }
  }
}
void force(int x, int c) {
  if (c == 10) {
    check();
    return;
  }
  force(x, c + 1);
  if (x > lenR) return;
  a[x] = c;
  force(x + 1, c);
  a[x] = 0;
}
int main() {
  scanf("%llu %llu", &L, &R);
  if (L == R) {
    printf("1\n");
    return 0;
  }
  for (unsigned long long r0 = R; r0; r0 /= 10) ++lenR;
  for (unsigned long long l0 = L; l0; l0 /= 10) ll[++lenL] = l0 % 10;
  p[1] = 1;
  for (int i = 2; i <= 19; i++) p[i] = p[i - 1] * 10;
  force(1, 1);
  printf("%d\n", ans);
  return 0;
}
