#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int cnt[11], tmp[11];
char l[22], r[22];
int nl, nr;
int solve1(int pos, int big, int small) {
  if (pos == nl) return 1;
  int cep = l[pos] - '0';
  if (big) cep = 0;
  int sag = r[pos] - '0';
  if (small) sag = 9;
  for (int i = cep; i <= sag; i++)
    if (tmp[i]) {
      tmp[i]--;
      if (solve1(pos + 1, ((l[pos] - '0') < i) | big,
                 ((r[pos] - '0') > i) | small))
        return 1;
      tmp[i]++;
    }
  return 0;
}
int solve(int take) {
  if (!take) return 0;
  for (int i = 1; i < 10; i++) tmp[i] = cnt[i];
  if (nl == nr) {
    tmp[0] = nr - take;
    return solve1(0, 0, 0);
  }
  if (take == nr) {
    int p = 1;
    for (int j = 0; j < nr; j++) {
      while (!tmp[p]) p++;
      if (p < r[j] - '0')
        return 1;
      else if (p > r[j] - '0')
        return 0;
      tmp[p]--;
    }
    return 1;
  }
  if (nl + 1 == nr) {
    tmp[0] = nl - take;
    int p = 9;
    for (int j = 0; j < nl; j++) {
      while (!tmp[p]) p--;
      if (p > r[j] - '0')
        return 1;
      else if (p < l[j] - '0') {
        for (int i = 1; i < 10; i++) tmp[i] = cnt[i];
        tmp[0] = nr - take;
        for (int i = 0; i < nr; i++)
          for (int k = (!i); k < 10; k++)
            if (tmp[k]) {
              if (k < r[i] - '0') return 1;
              if (k > r[i] - '0') return 0;
              tmp[k]--;
              break;
            }
        return 1;
      }
      tmp[p]--;
    }
    return 1;
  }
  return 1;
}
int rec(int pos, int dig) {
  if (dig == 10) {
    return solve(pos);
  }
  int ret = 0;
  for (int i = 0; i + pos <= nr; i++) {
    cnt[dig] += i;
    ret += rec(pos + i, dig + 1);
    cnt[dig] -= i;
  }
  return ret;
}
int main() {
  scanf("%s%s", l, r);
  nl = strlen(l);
  nr = strlen(r);
  printf("%d\n", rec(0, 1));
  return 0;
}
