#include <bits/stdc++.h>
using namespace std;
string a;
int b[10], c[20], d[20];
long long jc[20], myjc = 0;
void DFS(int x) {
  if (x == 10) {
    int cnt = 0;
    for (int i = 0; i <= 9; i++) cnt += d[i];
    long long ans = jc[cnt];
    for (int i = 0; i <= 9; i++) ans /= jc[d[i]];
    if (d[0] >= 1) ans -= (ans * d[0] / cnt);
    myjc += ans;
    return;
  }
  for (int i = 1; i <= b[x]; i++) {
    d[x] = i;
    DFS(x + 1);
  }
  if (b[x] == 0) DFS(x + 1);
}
signed main() {
  cin >> a;
  int len = a.size();
  for (int i = 0; i < len; i++) b[a[i] - '0']++;
  jc[0] = 1;
  for (int i = 1; i <= 19; i++) jc[i] = jc[i - 1] * i;
  DFS(0);
  printf("%lld", myjc);
  return 0;
}
