#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N = 3e5 + 10;
long long gcd(long long p, long long q) { return q == 0 ? p : gcd(q, p % q); }
int to[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
long long f[21], cnt[10], tp[10], ans;
void dfs(long long x, long long y) {
  if (x == 10) {
    long long s = 1, tmp = y, p = y;
    for (int i = 0; i < 10; i++)
      if (tp[i]) s = s * f[tmp] / f[tp[i]] / f[tmp - tp[i]], tmp -= tp[i];
    if (tp[0]) s -= s * tp[0] / y;
    ans += s;
    return;
  }
  for (int i = 1; i <= cnt[x]; i++) {
    tp[x] = i;
    dfs(x + 1, y + i);
  }
  if (cnt[x] == 0) dfs(x + 1, y);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  f[0] = f[1] = 1;
  for (long long i = 2; i <= 20; i++) f[i] = i * f[i - 1];
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) cnt[s[i] - '0']++;
  dfs(0, 0);
  cout << ans << endl;
  return 0;
}
