#include <bits/stdc++.h>
using namespace std;
long long result[1000] = {0};
long long fact(long long n) {
  if (result[n] != 0) return result[n];
  if (n >= 0) {
    result[0] = 1;
    for (long long i = 1; i <= n; ++i) {
      result[i] = i * result[i - 1];
    }
    return result[n];
  }
}
int main() {
  string s;
  cin >> s;
  long long occ[10];
  for (long long i = 0; i <= 9; i++) occ[i] = 0;
  for (long long i = 0; i < s.length(); i++) occ[(long long)(s[i] - '0')]++;
  long long n[10];
  long long res = 0;
  for (n[0] = 0; n[0] <= occ[0]; n[0]++)
    for (n[1] = 0; n[1] <= occ[1]; n[1]++)
      for (n[2] = 0; n[2] <= occ[2]; n[2]++)
        for (n[3] = 0; n[3] <= occ[3]; n[3]++)
          for (n[4] = 0; n[4] <= occ[4]; n[4]++)
            for (n[5] = 0; n[5] <= occ[5]; n[5]++)
              for (n[6] = 0; n[6] <= occ[6]; n[6]++)
                for (n[7] = 0; n[7] <= occ[7]; n[7]++)
                  for (n[8] = 0; n[8] <= occ[8]; n[8]++)
                    for (n[9] = 0; n[9] <= occ[9]; n[9]++) {
                      long long ok = 1;
                      for (long long i = 0; i <= 9; i++)
                        if (n[i] == 0 && occ[i] > 0) ok = 0;
                      if (!ok) continue;
                      long long sum = 0;
                      for (long long i = 0; i <= 9; i++) sum += n[i];
                      long long prod = 1;
                      for (long long i = 0; i <= 9; i++) prod *= fact(n[i]);
                      res += (fact(sum) / prod);
                      if (n[0] > 0) {
                        long long prod = 1;
                        for (long long i = 1; i <= 9; i++) prod *= fact(n[i]);
                        prod *= fact(n[0] - 1);
                        res -= (fact(sum - 1) / prod);
                      }
                    }
  cout << res;
  return 0;
}
