#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const int INF = 0x3F3F3F3F;
const int64_t LINF = 4611686018427387903;
const int MOD = 1e9 + 7;
int64_t frac[19];
int cnt[10], curcnt[10];
int64_t solve(int now) {
  int64_t res = 0;
  if (now == 10) {
    for (int i = 1; i < 10; i++) {
      if (!curcnt[i]) continue;
      curcnt[i]--;
      int64_t cur = 0, tot = 0;
      for (int i = 0; i < 10; i++) tot += curcnt[i];
      cur = frac[tot];
      for (int i = 0; i < 10; i++) cur /= frac[curcnt[i]];
      res += cur;
      curcnt[i]++;
    }
  } else {
    if (!cnt[now]) return solve(now + 1);
    for (int i = 0; i < cnt[now]; i++) {
      curcnt[now]++;
      res += solve(now + 1);
    }
    curcnt[now] = 0;
  }
  return res;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  frac[0] = 1;
  for (int i = 1; i < 19; i++) frac[i] = frac[i - 1] * i;
  string s;
  cin >> s;
  for (char &a : s) cnt[a - '0']++;
  cout << solve(0) << '\n';
  return 0;
}
