#include <bits/stdc++.h>
using namespace std;
int n;
char s[20];
int cnt[10], tmp[10];
long long ans;
long long C[25][25];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long cal(int x) {
  int left = x;
  long long res = 1;
  for (int i = 0; i <= 9; i++) {
    if (i == 0)
      res *= C[left - 1][tmp[0]];
    else
      res *= C[left][tmp[i]];
    left -= tmp[i];
  }
  return res;
}
void dfs(int x, int tot) {
  if (x > 9) {
    ans += cal(tot);
    return;
  }
  if (cnt[x] == 0)
    dfs(x + 1, tot);
  else
    for (int i = 1; i <= cnt[x]; i++) {
      tmp[x] = i;
      dfs(x + 1, tot + i);
    }
}
int main() {
  C[0][0] = 1;
  for (int i = 1; i <= 20; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
  }
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) cnt[s[i] - '0']++;
  dfs(0, 0);
  printf("%I64d", ans);
  return 0;
}
