#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int freq[10], bk[10];
int cnt = 0;
ll f[20];
ll solve(int i) {
  if (i == 10) {
    ll ret = f[cnt];
    for (int j = 0; j < 10; ++j) ret /= f[bk[j]];
    if (bk[0] != 0) {
      --bk[0];
      --cnt;
      ll rem = f[cnt];
      for (int j = 0; j < 10; ++j) rem /= f[bk[j]];
      ret -= rem;
      ++cnt;
      ++bk[0];
    }
    return ret;
  }
  if (freq[i] != 0) {
    ll ret = 0;
    for (int j = 1; j <= freq[i]; ++j) {
      bk[i] = j;
      cnt += j;
      ret += solve(i + 1);
      cnt -= j;
    }
    return ret;
  } else
    return solve(i + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin >> n;
  while (n != 0) {
    ++freq[n % 10];
    n /= 10;
  }
  f[0] = 1;
  for (int i = 1; i < 20; ++i) f[i] = f[i - 1] * i;
  cout << solve(0) << '\n';
  return 0;
}
