#include <bits/stdc++.h>
using namespace std;
int now[10];
int ans = 0;
int L[20];
int R[20];
void check(int pos) {
  if (pos < 0) {
    ans++;
    return;
  }
  if (L[pos] == R[pos]) {
    if (now[L[pos]]) {
      now[L[pos]]--;
      check(pos - 1);
      now[L[pos]]++;
    }
    return;
  }
  for (int i = L[pos] + 1; i <= R[pos] - 1; i++) {
    if (now[i]) {
      ans++;
      return;
    }
  }
  if (now[L[pos]]) {
    now[L[pos]]--;
    long long tmp = 0;
    for (int i = 9; i >= 0; i--) {
      for (int j = 0; j < now[i]; j++) {
        tmp = tmp * 10 + i;
      }
    }
    now[L[pos]]++;
    long long ll = 0;
    for (int i = pos - 1; i >= 0; i--) {
      ll = ll * 10 + L[i];
    }
    if (ll <= tmp) {
      ans++;
      return;
    }
  }
  if (now[R[pos]]) {
    now[R[pos]]--;
    long long tmp = 0;
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < now[i]; j++) {
        tmp = tmp * 10 + i;
      }
    }
    now[R[pos]]++;
    long long rr = 0;
    for (int i = pos - 1; i >= 0; i--) {
      rr = rr * 10 + R[i];
    }
    if (rr >= tmp) {
      ans++;
      return;
    }
  }
}
void dfss(int n, int step) {
  if (step == 18) {
    check(18);
    return;
  }
  for (int i = n; i < 10; i++) {
    now[i]++;
    dfss(i, step + 1);
    now[i]--;
  }
}
int main() {
  long long l, r;
  scanf("%lld%lld", &l, &r);
  for (int i = 0; i <= 18; i++) {
    L[i] = l % 10;
    l /= 10;
  }
  for (int i = 0; i <= 18; i++) {
    R[i] = r % 10;
    r /= 10;
  }
  now[0] = 1;
  dfss(0, 0);
  printf("%d\n", ans);
  return 0;
}
