#include <bits/stdc++.h>
#pragma optimize("O3")
using namespace std;
long long choose(long long n, long long k) {
  long long ans = 1;
  for (long long i = k + 1; i <= n; i++) {
    ans *= i;
    ans /= i - k;
  }
  return ans;
}
long long calc = 0;
long long cnt[10];
void apply_combinatorics(long long chosen[]) {
  int rem = 0;
  for (int i = 0; i < 10; i++) rem += chosen[i];
  long long tot = 1LL;
  if (chosen[0] != 0) {
    tot *= choose(rem - 1, chosen[0]);
    rem -= chosen[0];
  }
  for (int i = 1; i < 10; i++) {
    if (chosen[i] == 0) continue;
    tot *= choose(rem, chosen[i]);
    rem -= chosen[i];
  }
  calc += tot;
}
void brute_force(int p, long long current[]) {
  if (p == 10) {
    apply_combinatorics(current);
    return;
  }
  if (cnt[p] == 0) {
    current[p] = 0;
    brute_force(p + 1, current);
    return;
  }
  for (long long k = 1; k <= cnt[p]; k++) {
    current[p] = k;
    brute_force(p + 1, current);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  string s;
  cin >> s;
  for (char x : s) {
    cnt[x - '0']++;
  }
  long long store[10];
  memset(store, 0, sizeof store);
  brute_force(0, store);
  cout << calc;
  return 0;
}
