#include <bits/stdc++.h>
using namespace std;
long long int cnt;
vector<long long int> V;
int cs[5000000][10];
int TIME = -1;
void solve(int i, int a, int d[10]) {
  if (i == 19) {
    int u = ++TIME;
    for (int j = 0; j <= 9; j++) cs[u][j] = d[j];
    return;
  }
  for (int j = a; j <= 9; j++) {
    int d1[10];
    for (int k = 0; k <= 9; k++) d1[k] = d[k];
    d1[j]++;
    solve(i + 1, j, d1);
  }
}
long long int a[20], b[20];
long long int A, B;
const long long int K = 1e9 + 7;
long long int mu[20];
void init(long long int A, long long int B) {
  for (int i = 0; i <= 17; i++) a[i] = 0;
  long long int j = 0;
  while (A) {
    a[j] = A % 10;
    A /= 10;
    j++;
  }
  for (int i = 0; i <= 17; i++) b[i] = 0;
  j = 0;
  while (B) {
    b[j] = B % 10;
    B /= 10;
    j++;
  }
}
int d[11];
long long int aa[11];
inline bool calc(long long int u) {
  for (int i = 0; i <= 9; i++) d[i] = cs[u][i];
  for (int i = 17; i >= 0; i--) {
    if (a[i] == b[i]) {
      if (!d[a[i]])
        return 0;
      else
        d[a[i]]--;
    } else {
      for (int j = a[i] + 1; j <= b[i] - 1; j++) {
        if (d[j]) return 1;
      }
      if (d[a[i]]) {
        long long int w = A % mu[i];
        long long int r = 0;
        for (int j = 9; j >= 0; j--) {
          if (j != a[i])
            for (int k = 1; k <= d[j]; k++) r = r * 10 + j;
          else
            for (int k = 1; k <= d[j] - 1; k++) r = r * 10 + j;
        }
        if (w <= r) return 1;
      }
      if (d[b[i]]) {
        long long int w = B % mu[i];
        long long int r = 0;
        for (int j = 0; j <= 9; j++) {
          if (j != b[i])
            for (int k = 1; k <= d[j]; k++) r = r * 10 + j;
          else
            for (int k = 1; k <= d[j] - 1; k++) r = r * 10 + j;
        }
        if (w >= r) return 1;
      }
      return 0;
    }
  }
  return 1;
}
int ee[10];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  mu[0] = 1;
  for (int i = 1; i <= 18; i++) {
    mu[i] = mu[i - 1] * 10;
  }
  solve(1, 0, ee);
  cin >> A >> B;
  const long long int C = 1e18;
  if (A == B && B == C) {
    cout << 1;
    return 0;
  }
  if (B == C) B--;
  init(A, B);
  long long int res = 0;
  if (B == C - 1)
    res++;
  else
    res += calc(1);
  for (int i = 2; i <= TIME; i++) {
    bool t = calc(i);
    res += t;
  }
  cout << res << endl;
  return 0;
}
