#include <bits/stdc++.h>
using namespace std;
int app[11];
int use[11];
long long int ans = 0;
long long int step[20];
void dfs(int now, int hd) {
  if (now >= 10) {
    int i, sum = 0;
    for (i = 0; i < 10; i++) sum += use[i];
    long long int tmp = step[sum];
    for (i = 0; i < 10; i++)
      if (use[i]) tmp /= step[use[i]];
    ans += tmp;
    return;
  }
  if (app[now] == 0) {
    use[now] = 0;
    dfs(now + 1, hd);
  } else {
    if (now == hd) {
      use[now] = 0;
      dfs(now + 1, hd);
    }
    for (int i = 1; i <= app[now]; i++) {
      use[now] = i;
      dfs(now + 1, hd);
    }
  }
}
int main(void) {
  long long int n;
  scanf("%lld", &n);
  while (n) {
    app[n % 10]++;
    n /= 10;
  }
  int i;
  step[0] = step[1] = 1;
  for (i = 2; i <= 18; i++) step[i] = step[i - 1] * i;
  for (i = 1; i < 10; i++) {
    if (app[i] == 0) continue;
    app[i]--;
    dfs(0, i);
    app[i]++;
  }
  printf("%lld\n", ans);
  return 0;
}
