#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXDIG = 19;
const int MAXC = MAXDIG + 1 + 10;
long long C[MAXC + 1][MAXC + 1];
int nd;
int dl[MAXDIG], ndl;
int dr[MAXDIG], ndr;
long long calc(int len, int mask) {
  int nopt = 0;
  for (int i = (0); i < (10); ++i)
    if ((mask & (1 << i)) == 0) ++nopt;
  return nopt == 0 ? 0 : C[len + nopt - 1][nopt - 1];
}
long long calcabove(int at, int mask) {
  int omask = mask;
  if (at >= nd) return 1;
  long long ret = 0;
  int nrem = nd - at - 1;
  for (int a = (dl[at] + 1); a <= (9); ++a)
    if ((mask & (1 << a)) == 0) ret += calc(nrem, mask), mask |= 1 << a;
  if ((mask & (1 << dl[at])) == 0) ret += calcabove(at + 1, mask);
  return ret;
}
long long calcbelow(int at, int mask) {
  int omask = mask;
  if (at >= nd) return 1;
  long long ret = 0;
  int nrem = nd - at - 1;
  for (int a = (0); a <= (dr[at] - 1); ++a)
    if ((mask & (1 << a)) == 0) ret += calc(nrem, mask), mask |= 1 << a;
  if ((mask & (1 << dr[at])) == 0) ret += calcbelow(at + 1, mask);
  return ret;
}
long long calcboth(int atr, int mask, vector<int> &cntrneed) {
  int omask = mask;
  if (atr >= nd) {
    for (int i = (0); i < (10); ++i)
      if (cntrneed[i] > 0) return 0;
    return 1;
  }
  long long ret = 0;
  int nrem = nd - atr - 1;
  bool done = false;
  for (int a = (0); a <= (dr[atr] - 1); ++a)
    if (cntrneed[a] > 0 || (mask & (1 << a)) == 0) {
      bool needed = cntrneed[a] > 0;
      if (needed) --cntrneed[a];
      int sum = 0;
      for (int i = (0); i < (10); ++i) sum += cntrneed[i];
      if (sum <= nrem)
        ret += calc(nrem - sum, mask), mask |= 1 << a, done = needed;
      if (needed) ++cntrneed[a];
      if (done) break;
    }
  if (!done && (cntrneed[dr[atr]] > 0 || (mask & (1 << dr[atr])) == 0)) {
    bool needed = cntrneed[dr[atr]] > 0;
    if (needed) --cntrneed[dr[atr]];
    ret += calcboth(atr + 1, mask, cntrneed);
    if (needed) ++cntrneed[dr[atr]];
  }
  return ret;
}
long long calcboth(int atl, int atr, int mask, vector<int> &cntlneed,
                   vector<int> &cntrneed) {
  int omask = mask;
  if (atl >= nd) {
    for (int i = (0); i < (10); ++i)
      if (cntlneed[i] > 0) return 0;
    return calcboth(atr, mask, cntrneed);
  }
  long long ret = 0;
  int nrem = nd - atl - 1;
  bool done = false;
  for (int a = (dl[atl] + 1); a <= (9); ++a)
    if ((mask & (1 << a)) == 0) {
      if (cntlneed[a] > 0)
        --cntlneed[a];
      else
        ++cntrneed[a];
      int sum = 0;
      for (int i = (0); i < (10); ++i) sum += cntlneed[i];
      if (sum <= nrem)
        ret += calcboth(atr, mask, cntrneed), mask |= 1 << a,
            done = cntrneed[a] == 0;
      if (cntrneed[a] > 0)
        --cntrneed[a];
      else
        ++cntlneed[a];
      if (done) break;
    }
  if (!done && (mask & (1 << dl[atl])) == 0) {
    if (cntlneed[dl[atl]] > 0)
      --cntlneed[dl[atl]];
    else
      ++cntrneed[dl[atl]];
    ret += calcboth(atl + 1, atr, mask, cntlneed, cntrneed);
    if (cntrneed[dl[atl]] > 0)
      --cntrneed[dl[atl]];
    else
      ++cntlneed[dl[atl]];
  }
  return ret;
}
long long solve(long long ql, long long qr) {
  memset(C, 0, sizeof(C));
  for (int i = (0); i <= (MAXC); ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = (1); j < (i); ++j) C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
  }
  ndl = 0;
  for (long long x = ql; x != 0; x /= 10) dl[ndl++] = x % 10;
  ndr = 0;
  for (long long x = qr; x != 0; x /= 10) dr[ndr++] = x % 10;
  nd = ndr;
  while (ndl < nd) dl[ndl++] = 0;
  reverse(dl, dl + ndl);
  reverse(dr, dr + ndr);
  int s = 0;
  while (s < nd && dl[s] == dr[s]) ++s;
  if (s >= nd) return 1;
  long long ret = 0;
  int mask = 0;
  int nrem = nd - s - 1;
  for (int a = (dl[s] + 1); a <= (dr[s] - 1); ++a)
    ret += calc(nrem, mask), mask |= 1 << a;
  ret += calcabove(s + 1, mask);
  ret += calcbelow(s + 1, mask);
  vector<int> cntlneed(10, 0), cntrneed(10, 0);
  ++cntlneed[dr[s]];
  ++cntrneed[dl[s]];
  ret -= calcboth(s + 1, s + 1, mask, cntlneed, cntrneed);
  return ret;
}
void run() {
  long long ql, qr;
  scanf("%lld%lld", &ql, &qr);
  printf("%lld\n", solve(ql, qr));
}
void stress() {
  int lim = 10000;
  for (int l = (1); l <= (lim); ++l) {
    set<int> cur;
    for (int r = (l); r <= (lim); ++r) {
      vector<int> d;
      for (int x = r; x != 0; x /= 10) d.push_back(x % 10);
      sort(d.begin(), d.end());
      int z = 0;
      for (int i = (0); i < (((int)(d).size())); ++i) z = 10 * z + d[i];
      cur.insert(z);
      long long have = solve(l, r), want = ((int)(cur).size());
      if (have != want) {
        printf("%d %d: have=%lld want=%lld\n", l, r, have, want);
      }
    }
  }
}
int main() {
  run();
  return 0;
}
