#include <bits/stdc++.h>
using namespace std;
const int maxn = 25;
long long n;
long long ans = 0;
long long have[maxn];
long long nowhave[maxn];
long long fac[maxn];
void init() {
  fac[0] = 1;
  for (int i = 1; i <= 19; ++i) fac[i] = fac[i - 1] * i;
}
long long cal() {
  int cnt = 0;
  for (int i = 0; i <= 9; ++i) {
    cnt += nowhave[i];
  }
  long long p = fac[cnt];
  for (int i = 0; i <= 9; ++i) {
    p /= fac[nowhave[i]];
  }
  return p;
}
void dfs(int pos) {
  if (pos > 9) {
    ans += cal();
    if (nowhave[0] >= 1) {
      nowhave[0]--;
      ans -= cal();
      nowhave[0]++;
    }
    return;
  }
  if (have[pos]) {
    for (int i = 1; i <= have[pos]; ++i) {
      nowhave[pos] = i;
      dfs(pos + 1);
    }
  } else
    dfs(pos + 1);
}
int main() {
  init();
  scanf("%I64d", &n);
  while (n) {
    have[n % 10]++;
    n /= 10;
  }
  dfs(0);
  printf("%I64d\n", ans);
  return 0;
}
