#include <bits/stdc++.h>
using namespace std;
long long num[10], tempNum[10], a[10];
long long jc[20], ans = 0;
void dfs(long long x) {
  if (x == 10) {
    long long now = 1, cnt = 0, tmp = 0;
    for (long long i = 0; i < 10; i++) {
      cnt += tempNum[i];
      now = now * jc[tempNum[i]];
    }
    now = jc[cnt] / now;
    if (tempNum[0] >= 1) {
      tmp = jc[cnt - 1];
      tmp /= jc[tempNum[0] - 1];
      for (long long i = 1; i < 10; i++) tmp /= jc[tempNum[i]];
    }
    now -= tmp;
    ans += now;
    return;
  }
  for (long long i = 1; i <= a[x]; i++) {
    tempNum[x] = i;
    dfs(x + 1);
  }
  if (!a[x]) dfs(x + 1);
}
void solve() {
  jc[0] = 1;
  for (long long i = 1; i < 20; i++) jc[i] = jc[i - 1] * i;
  string s;
  cin >> s;
  for (long long i = 0; i < s.length(); i++) a[s[i] - '0']++;
  dfs(0);
  printf("%lld\n", ans);
}
signed main() {
  solve();
  return 0;
}
