#include <bits/stdc++.h>
using namespace std;
long long L, R;
int pl[666666], pr[666666], cho[666666];
int ps = 0, cn[23333][19], ok[23333], rm[23333];
void tryy(int d, int s = 0) {
  if (d < 0) return;
  bool OO = 0;
  for (int g = 0; g <= 9; ++g) {
    if (g < pl[d] && !(s & 1)) continue;
    if (g > pr[d] && !(s & 2)) continue;
    int ns = s;
    if (g > pl[d]) ns |= 1;
    if (g < pr[d]) ns |= 2;
    if (ns != 3)
      cho[d] = g, tryy(d - 1, ns);
    else
      OO = 1;
  }
  if (OO)
    ;
  else
    return;
  ++ps;
  for (int i = d + 1; i <= 19; ++i) ++cn[ps][cho[i]];
  rm[ps] = d;
  for (int g = 0; g <= 9; ++g) {
    if (g < pl[d] && !(s & 1)) continue;
    if (g > pr[d] && !(s & 2)) continue;
    int ns = s;
    if (g > pl[d]) ns |= 1;
    if (g < pr[d]) ns |= 2;
    if (ns != 3) continue;
    ok[ps] |= 1 << g;
  }
}
long long ans = 0;
int cur[18], ls[233];
void dfs(int x) {
  for (int i = ps; i >= 1; --i) {
    register int tn = 0, pp = 0;
    for (register int j = 1; j <= 9; ++j) {
      if (cn[i][j] < cur[j])
        tn += cur[j] - cn[i][j], pp |= 1 << j;
      else if (cn[i][j] > cur[j])
        goto ed;
    }
    if (pp & ok[i])
      --tn;
    else if (ok[i] & 1)
      ;
    else
      continue;
    if (tn <= rm[i]) {
      ++ans;
      break;
    }
  ed:;
  }
  if (x >= 19) return;
  for (ls[x] = ls[x - 1]; ls[x] <= 9; ++ls[x])
    ++cur[ls[x]], dfs(x + 1), --cur[ls[x]];
}
int main() {
  cin >> L >> R;
  --L, ++R;
  for (int i = 0; i <= 19; ++i) {
    pl[i] = L % 10, L /= 10;
    pr[i] = R % 10, R /= 10;
  }
  tryy(19);
  ls[0] = 1;
  dfs(1);
  cout << ans << "\n";
}
