#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793238462643383;
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int Ceil(long long int a, long long int b) {
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}
const int MAX = 200009;
const int MOD = 1e9 + 7;
const int inf = 1e9 + 10;
long long int f[55];
long long int cnt[20];
void pre() {
  f[0] = 1, f[1] = 1;
  for (int i = (1); i <= (50); ++i) f[i] = f[i - 1] * i;
}
map<vector<int>, int> mp;
long long int solve(vector<int>& v) {
  long long int ans = 0;
  long long int s = 0;
  for (auto&(it) : (v)) s += it;
  if (mp.find(v) != mp.end())
    return 0;
  else
    mp[v] = 1;
  if (s == 0) return 0;
  long long int t1 = f[s];
  for (auto&(it) : (v)) t1 /= f[it];
  long long int t2 = f[s - 1];
  if (v[0] > 0) {
    t2 /= f[v[0] - 1];
    for (int i = (1); i <= ((int)((v).size()) - 1); ++i) t2 /= f[v[i]];
  } else
    t2 = 0;
  ans = t1 - t2;
  for (int i = (0); i <= (9); ++i)
    if (v[i] > 1) {
      v[i]--;
      vector<int> w;
      for (int i = 0; i < (10); ++i) w.push_back(v[i]);
      ans += solve(w);
      v[i]++;
    }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pre();
  string s;
  cin >> s;
  for (int i = 0; i < ((int)((s).size())); ++i) cnt[s[i] - '0']++;
  vector<int> v;
  for (int i = 0; i < (10); ++i) v.push_back(cnt[i]);
  cout << solve(v);
  return 0;
}
