#include <bits/stdc++.h>
using namespace std;
template <class T, class T2>
inline int chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2>
inline int chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const int MAXN = (1 << 20);
struct state {
  uint64_t h;
  state() { h = 0; }
  inline void add(int x) { h += (1ll << (5ll * (x - 1ll))); }
  inline void rem(int x) { h -= (1ll << (5ll * (x - 1ll))); }
  inline int get(int x) { return (h >> (5ll * (x - 1ll))) & 31ll; }
};
string _L, _R;
vector<int> L, R;
void read() {
  cin >> _L >> _R;
  while (_L.size() < _R.size()) _L = "0" + _L;
  for (int c : _L) L.push_back(c - '0');
  for (int c : _R) R.push_back(c - '0');
}
vector<state> li;
state curr;
void gen(int l, int last = 1) {
  if (l != 18) li.push_back(curr);
  if (l == 0) return;
  for (int d = last; d <= 9; d++) {
    curr.add(d);
    gen(l - 1, d);
    curr.rem(d);
  }
}
void solve() {
  gen(R.size() == 19 ? 18 : R.size());
  int answer = 0;
  for (auto it : li) {
    vector<int> c(10, 0);
    for (int d = 1; d < 10; d++) c[d] = it.get(d);
    bool bd = 0;
    int st = 0;
    while (st < (int)R.size() && R[st] == L[st]) {
      if (R[st] != 0) c[R[st]]--;
      st++;
    }
    for (int x : c)
      if (x < 0) bd = 1;
    if (bd) continue;
    vector<int> bk = c;
    int gd = 0;
    int cnt = 0;
    for (int i : c) cnt += i;
    int is_less = 0;
    for (int p = st; p < (int)R.size(); p++) {
      for (int d = (is_less == 0) ? (L[p] + 1) : 0; d < R[p]; d++)
        if (d == 0 || c[d]) {
          if (d != 0) cnt--;
          if (cnt <= (int)R.size() - p - 1) {
            gd = 1;
            break;
          }
          if (d != 0) cnt++;
        }
      if (gd == 1) break;
      if (R[p] != 0) c[R[p]]--, cnt--;
      if (c[R[p]] == -1) {
        gd = -1;
        break;
      }
      is_less = 1;
    }
    if (cnt == 0 && gd != -1) gd = 1;
    if (gd == 1) {
      answer++;
      continue;
    }
    c = bk;
    gd = 0;
    cnt = 0;
    for (auto i : c) cnt += i;
    int is_greater = 0;
    for (int p = st; p < (int)L.size(); p++) {
      for (int d = L[p] + 1; d < (is_greater ? 10 : R[p]); d++)
        if (c[d]) {
          if (cnt <= (int)L.size() - p) {
            gd = 1;
            break;
          }
        }
      if (gd == 1) break;
      if (L[p] != 0) c[L[p]]--, cnt--;
      if (c[L[p]] == -1) {
        gd = -1;
        break;
      }
      is_greater = 1;
    }
    if (cnt == 0 && gd != -1) gd = 1;
    if (gd == 1) {
      answer++;
      continue;
    }
  }
  cout << answer << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
