#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
int freq[10];
long long fact[20];
long long calc() {
  long long p = 0, q = 1;
  for (int i = (0); i < (10); ++i) {
    p += freq[i];
    q *= fact[freq[i]];
  }
  long long ans = fact[p] / q;
  for (int i = (0); i < (freq[0]); ++i) {
    p--;
    q /= (freq[0] - i);
    for (int j = (1); j < (10); ++j)
      if (freq[j] > 0) ans -= (fact[p - 1] * freq[j]) / q;
  }
  return ans;
}
long long solve(int id) {
  if (id == 10) return calc();
  long long ans = solve(id + 1);
  if (freq[id] > 1) {
    freq[id]--;
    ans += solve(id);
    freq[id]++;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  fact[0] = 1;
  for (int i = (1); i < (20); ++i) fact[i] = i * fact[i - 1];
  string s;
  cin >> s;
  int n = s.size();
  for (int i = (0); i < (n); ++i) freq[s[i] - '0']++;
  long long ans = solve(0);
  cout << ans << '\n';
  return 0;
}
