#include <bits/stdc++.h>
using namespace std;
int o[10], now[10];
long long ans, sum, q[20];
void dfs(int x) {
  if (x == 10) {
    int t = 0;
    for (int i = 0; i < 10; i++) t += now[i];
    sum = q[t];
    for (int i = 0; i < 10; i++) sum /= q[now[i]];
    if (now[0]) sum -= (sum * now[0] / t);
    ans += sum;
    return;
  }
  if (o[x] == 0)
    dfs(x + 1);
  else
    for (int i = 1; i <= o[x]; i++) {
      now[x] = i;
      dfs(x + 1);
    }
}
int main() {
  std::ios::sync_with_stdio(false);
  q[0] = 1;
  q[1] = 1;
  for (int i = 2; i <= 19; i++) q[i] = q[i - 1] * i;
  int n;
  string s;
  while (cin >> s) {
    memset(o, 0, sizeof(o));
    ans = 0;
    n = s.size();
    for (int i = 0; i < n; i++) o[s[i] - 48]++;
    dfs(0);
    cout << ans << endl;
  }
  return 0;
}
