Problem: <image>

Recently, a wild Krakozyabra appeared at Jelly Castle. It is, truth to be said, always eager to have something for dinner.

Its favorite meal is natural numbers (typically served with honey sauce), or, to be more precise, the zeros in their corresponding decimal representations. As for other digits, Krakozyabra dislikes them; moreover, they often cause it indigestion! So, as a necessary precaution, Krakozyabra prefers to sort the digits of a number in non-descending order before proceeding to feast. Then, the leading zeros of the resulting number are eaten and the remaining part is discarded as an inedible tail.

For example, if Krakozyabra is to have the number 57040 for dinner, its inedible tail would be the number 457.

Slastyona is not really fond of the idea of Krakozyabra living in her castle. Hovewer, her natural hospitality prevents her from leaving her guest without food. Slastyona has a range of natural numbers from L to R, which she is going to feed the guest with. Help her determine how many distinct inedible tails are going to be discarded by Krakozyabra by the end of the dinner.

Input

In the first and only string, the numbers L and R are given – the boundaries of the range (1 ≤ L ≤ R ≤ 1018).

Output

Output the sole number – the answer for the problem.

Examples

Input

1 10


Output

9


Input

40 57


Output

17


Input

157 165


Output

9

Note

In the first sample case, the inedible tails are the numbers from 1 to 9. Note that 10 and 1 have the same inedible tail – the number 1.

In the second sample case, each number has a unique inedible tail, except for the pair 45, 54. The answer to this sample case is going to be (57 - 40 + 1) - 1 = 17.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXDIG = 19;
const int MAXC = MAXDIG + 1 + 10;
long long C[MAXC + 1][MAXC + 1];
int nd;
int dl[MAXDIG], ndl;
int dr[MAXDIG], ndr;
long long calc(int len, int mask) {
  int nopt = 0;
  for (int i = (0); i < (10); ++i)
    if ((mask & (1 << i)) == 0) ++nopt;
  return nopt == 0 ? 0 : C[len + nopt - 1][nopt - 1];
}
long long calcabove(int at, int mask) {
  int omask = mask;
  if (at >= nd) return 1;
  long long ret = 0;
  int nrem = nd - at - 1;
  for (int a = (dl[at] + 1); a <= (9); ++a)
    if ((mask & (1 << a)) == 0) ret += calc(nrem, mask), mask |= 1 << a;
  if ((mask & (1 << dl[at])) == 0) ret += calcabove(at + 1, mask);
  return ret;
}
long long calcbelow(int at, int mask) {
  int omask = mask;
  if (at >= nd) return 1;
  long long ret = 0;
  int nrem = nd - at - 1;
  for (int a = (0); a <= (dr[at] - 1); ++a)
    if ((mask & (1 << a)) == 0) ret += calc(nrem, mask), mask |= 1 << a;
  if ((mask & (1 << dr[at])) == 0) ret += calcbelow(at + 1, mask);
  return ret;
}
long long calcboth(int atr, int mask, vector<int> &cntrneed) {
  int omask = mask;
  if (atr >= nd) {
    for (int i = (0); i < (10); ++i)
      if (cntrneed[i] > 0) return 0;
    return 1;
  }
  long long ret = 0;
  int nrem = nd - atr - 1;
  bool done = false;
  for (int a = (0); a <= (dr[atr] - 1); ++a)
    if (cntrneed[a] > 0 || (mask & (1 << a)) == 0) {
      bool needed = cntrneed[a] > 0;
      if (needed) --cntrneed[a];
      int sum = 0;
      for (int i = (0); i < (10); ++i) sum += cntrneed[i];
      if (sum <= nrem)
        ret += calc(nrem - sum, mask), mask |= 1 << a, done = needed;
      if (needed) ++cntrneed[a];
      if (done) break;
    }
  if (!done && (cntrneed[dr[atr]] > 0 || (mask & (1 << dr[atr])) == 0)) {
    bool needed = cntrneed[dr[atr]] > 0;
    if (needed) --cntrneed[dr[atr]];
    ret += calcboth(atr + 1, mask, cntrneed);
    if (needed) ++cntrneed[dr[atr]];
  }
  return ret;
}
long long calcboth(int atl, int atr, int mask, vector<int> &cntlneed,
                   vector<int> &cntrneed) {
  int omask = mask;
  if (atl >= nd) {
    for (int i = (0); i < (10); ++i)
      if (cntlneed[i] > 0) return 0;
    return calcboth(atr, mask, cntrneed);
  }
  long long ret = 0;
  int nrem = nd - atl - 1;
  bool done = false;
  for (int a = (dl[atl] + 1); a <= (9); ++a)
    if ((mask & (1 << a)) == 0) {
      if (cntlneed[a] > 0)
        --cntlneed[a];
      else
        ++cntrneed[a];
      int sum = 0;
      for (int i = (0); i < (10); ++i) sum += cntlneed[i];
      if (sum <= nrem)
        ret += calcboth(atr, mask, cntrneed), mask |= 1 << a,
            done = cntrneed[a] == 0;
      if (cntrneed[a] > 0)
        --cntrneed[a];
      else
        ++cntlneed[a];
      if (done) break;
    }
  if (!done && (mask & (1 << dl[atl])) == 0) {
    if (cntlneed[dl[atl]] > 0)
      --cntlneed[dl[atl]];
    else
      ++cntrneed[dl[atl]];
    ret += calcboth(atl + 1, atr, mask, cntlneed, cntrneed);
    if (cntrneed[dl[atl]] > 0)
      --cntrneed[dl[atl]];
    else
      ++cntlneed[dl[atl]];
  }
  return ret;
}
long long solve(long long ql, long long qr) {
  memset(C, 0, sizeof(C));
  for (int i = (0); i <= (MAXC); ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = (1); j < (i); ++j) C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
  }
  ndl = 0;
  for (long long x = ql; x != 0; x /= 10) dl[ndl++] = x % 10;
  ndr = 0;
  for (long long x = qr; x != 0; x /= 10) dr[ndr++] = x % 10;
  nd = ndr;
  while (ndl < nd) dl[ndl++] = 0;
  reverse(dl, dl + ndl);
  reverse(dr, dr + ndr);
  int s = 0;
  while (s < nd && dl[s] == dr[s]) ++s;
  if (s >= nd) return 1;
  long long ret = 0;
  int mask = 0;
  int nrem = nd - s - 1;
  for (int a = (dl[s] + 1); a <= (dr[s] - 1); ++a)
    ret += calc(nrem, mask), mask |= 1 << a;
  ret += calcabove(s + 1, mask);
  ret += calcbelow(s + 1, mask);
  vector<int> cntlneed(10, 0), cntrneed(10, 0);
  ++cntlneed[dr[s]];
  ++cntrneed[dl[s]];
  ret -= calcboth(s + 1, s + 1, mask, cntlneed, cntrneed);
  return ret;
}
void run() {
  long long ql, qr;
  scanf("%lld%lld", &ql, &qr);
  printf("%lld\n", solve(ql, qr));
}
void stress() {
  int lim = 10000;
  for (int l = (1); l <= (lim); ++l) {
    set<int> cur;
    for (int r = (l); r <= (lim); ++r) {
      vector<int> d;
      for (int x = r; x != 0; x /= 10) d.push_back(x % 10);
      sort(d.begin(), d.end());
      int z = 0;
      for (int i = (0); i < (((int)(d).size())); ++i) z = 10 * z + d[i];
      cur.insert(z);
      long long have = solve(l, r), want = ((int)(cur).size());
      if (have != want) {
        printf("%d %d: have=%lld want=%lld\n", l, r, have, want);
      }
    }
  }
}
int main() {
  run();
  return 0;
}