#include <bits/stdc++.h>
using namespace std;
const int N = 22;
long long fact[N];
int freq[N];
char str[N];
long long dp[N][N];
long long solve(int cur = 0, int sum = 0) {
  if (cur == 11) return fact[sum];
  long long &ret = dp[cur][sum];
  if (~ret) return ret;
  if (freq[cur] == 0) return ret = solve(cur + 1, sum);
  ret = 0;
  if (cur != 10) {
    for (int i = freq[cur]; i >= 1; i--) {
      ret += solve(cur + 1, sum + i) / fact[i];
    }
  } else {
    for (int i = int(0); i <= int(freq[cur]); i++) {
      ret += solve(cur + 1, sum + i) / fact[i];
    }
  }
  return ret;
}
int main() {
  memset(dp, -1, sizeof dp);
  fact[0] = 1;
  for (int i = int(1); i <= int(N - 1); i++) fact[i] = fact[i - 1] * i;
  scanf("%s", str);
  int n = strlen(str);
  for (int i = 0; i < int(n); i++) freq[str[i] - '0']++;
  sort(freq + 1, freq + 10);
  long long ans = solve();
  if (freq[0]) {
    long long fz = freq[0];
    freq[0] = 1;
    freq[10] = fz - 1;
    memset(dp, -1, sizeof dp);
    ans -= solve(1, 0);
  }
  printf("%lld\n", ans);
  return 0;
}
