#include <bits/stdc++.h>
const long long INF = (1e9 + 12312), MOD = 1e9 + 7;
const long double EPS = 0.0000000001;
using namespace std;
long long kol[12];
long long fact[20];
long long inUse[12];
long long ans = 0;
long long getAns() {
  long long all = 0;
  for (long long i = 0; i < 10; i++) {
    all += inUse[i];
  }
  long long ans = fact[all];
  for (long long i = 0; i < 10; i++) {
    ans /= fact[inUse[i]];
  }
  return ans;
}
void recur(long long now) {
  if (now == 10) {
    for (long long i = 1; i < 10; i++) {
      if (inUse[i] > 0) {
        inUse[i]--;
        ans += getAns();
        inUse[i]++;
      }
    }
    return;
  }
  if (kol[now] == 0) {
    recur(now + 1);
  }
  for (long long i = 1; i <= kol[now]; i++) {
    inUse[now] = i;
    recur(now + 1);
  }
  inUse[now] = 0;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  srand(time(NULL));
  string s;
  cin >> s;
  fact[0] = 1;
  for (long long i = 1; i < 19; i++) {
    fact[i] = fact[i - 1] * i;
  }
  for (long long i = 0; i < (long long)s.size(); i++) {
    kol[s[i] - '0']++;
  }
  recur(0);
  cout << ans;
  return 0;
}
