#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int K = 18;
int cnt[10];
string l, r;
bool exists(int lb, int rb) {
  for (int i = lb; i <= rb; i++)
    if (cnt[i] > 0) return true;
  return false;
}
bool test(int, bool, bool);
bool try_test(int p, bool lf, bool rf, int x) {
  if (cnt[x] == 0) return false;
  cnt[x]--;
  bool res = test(p, lf, rf);
  cnt[x]++;
  return res;
}
bool test(int p, bool lf, bool rf) {
  if (p == l.size()) return true;
  if (lf && rf) {
    if (l[p] == r[p]) return try_test(p + 1, true, true, l[p]);
    if (exists(l[p] + 1, r[p] - 1)) return true;
    return try_test(p + 1, true, false, l[p]) ||
           try_test(p + 1, false, true, r[p]);
  }
  if (lf) {
    if (exists(l[p] + 1, 9)) return true;
    return try_test(p + 1, true, false, l[p]);
  }
  if (exists(0, r[p] - 1)) return true;
  return try_test(p + 1, false, true, r[p]);
}
int search(int k, int n) {
  if (n == l.size()) return test(0, true, true);
  if (k == 10) return 0;
  int res = 0;
  for (cnt[k] = 0; n <= l.size(); cnt[k]++, n++) res += search(k + 1, n);
  cnt[k] = 0;
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> l >> r;
  while (l.size() < r.size()) l.insert(l.begin(), '0');
  for (int i = 0; i < l.size(); i++) {
    l[i] -= '0';
    r[i] -= '0';
  }
  cout << search(0, 0);
}
