#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  if (!(~ch)) return 0;
  int f = 1;
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  long long x = 0;
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
long long ans, f[21], cnt[10], tp[10];
inline void dfs(long long x, long long y) {
  if (x == 10) {
    long long s = 1, tmp = y;
    for (int i = 0; i < 10; i++)
      if (tp[i]) {
        s = s * f[tmp] / f[tp[i]] / f[tmp - tp[i]];
        tmp -= tp[i];
      }
    if (tp[0]) s -= s * tp[0] / y;
    ans += s;
    return;
  }
  int step = x + 1;
  for (register int i = 1; i <= cnt[x]; ++i) {
    tp[x] = i;
    dfs(step, y + i);
  }
  if (!cnt[x]) dfs(step, y);
}
int main() {
  f[0] = f[1] = 1;
  for (long long i = 2; i < 21; ++i) f[i] = i * f[i - 1];
  string s;
  cin >> s;
  int n = s.length();
  for (register int i = 0; i < n; ++i) cnt[s[i] ^ 48]++;
  dfs(0, 0);
  printf("%lld\n", ans);
  return 0;
}
