#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
const int NUM = 50;
long long comb[NUM + 1][NUM / 2 + 1];
void make_comb() {
  comb[0][0] = 1;
  for (int i = 1; i <= NUM; i++) {
    comb[i][0] = 1;
    for (int j = 1; j <= NUM / 2; j++) {
      comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
    }
  }
}
long long nCk(int n, int k) { return comb[n][min(k, n - k)]; }
int C[10];
long long dp[11][60];
long long solve() {
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for (int t = 0, t_len = (10); t < t_len; ++t) {
    if (C[t]) {
      for (int i = 0, i_len = (30); i < i_len; ++i)
        if (dp[t][i]) {
          for (int w = 1; w <= C[t]; w++) {
            dp[t + 1][i + w] += dp[t][i] * nCk(i + w, w);
          }
        }
    } else {
      for (int i = 0, i_len = (30); i < i_len; ++i) dp[t + 1][i] = dp[t][i];
    }
  }
  long long ans = 0;
  for (int i = 0, i_len = (30); i < i_len; ++i) ans += dp[10][i];
  return ans;
}
void MAIN() {
  make_comb();
  {
    static char S[111];
    scanf("%s", S);
    int n = strlen(S);
    for (int i = 0, i_len = (n); i < i_len; ++i) C[S[i] - '0']++;
  }
  long long ans = solve();
  if (C[0]) {
    C[0]--;
    ans -= solve();
    if (C[0]) {
      C[0] = 0;
      ans -= solve();
    }
  }
  printf("%lld\n", ans);
}
int main() {
  int TC = 1;
  for (int tc = 0, tc_len = (TC); tc < tc_len; ++tc) MAIN();
  return 0;
}
