#include <bits/stdc++.h>
using namespace std;
map<int, int> col;
long long int co(long long int k, long long int n) {
  long long int tr = 1;
  if (k == 0) return 1;
  for (long long int i = 2; i <= n; i++) tr = tr * i;
  for (long long int i = 2; i <= k; i++) tr = tr / i;
  for (long long int i = 2; i <= n - k; i++) tr = tr / i;
  return tr;
}
int main() {
  long long int n, res = 0, curres;
  cin >> n;
  vector<int> s(10, 0);
  while (n) {
    col[n % 10]++;
    s[n % 10] = 1;
    n = n / 10;
  }
  for (int i = s[0]; i <= col[0]; i++) {
    for (int j = s[1]; j <= col[1]; j++) {
      for (int q = s[2]; q <= col[2]; q++) {
        for (int w = s[3]; w <= col[3]; w++) {
          for (int e = s[4]; e <= col[4]; e++) {
            for (int r = s[5]; r <= col[5]; r++) {
              for (int t = s[6]; t <= col[6]; t++) {
                for (int y = s[7]; y <= col[7]; y++) {
                  for (int u = s[8]; u <= col[8]; u++) {
                    for (int a = s[9]; a <= col[9]; a++) {
                      int sum = i + j + q + w + e + r + t + y + u + a;
                      curres = 1;
                      curres *= co(i, sum - 1);
                      curres *= co(j, sum - i);
                      curres *= co(q, sum - i - j);
                      curres *= co(w, sum - i - j - q);
                      curres *= co(e, sum - i - j - q - w);
                      curres *= co(r, sum - i - j - q - w - e);
                      curres *= co(t, sum - i - j - q - w - e - r);
                      curres *= co(y, sum - i - j - q - w - e - r - t);
                      curres *= co(u, sum - i - j - q - w - e - r - t - y);
                      curres *= co(a, sum - i - j - q - w - e - r - t - y - u);
                      res += curres;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  cout << res;
}
