#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 29);
const int INFF = 0x7fffffff;
const long long LINF = (1ll << 60);
const long long LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;
long long fact[20] = {};
long long solve(vector<int> v, int i, int rmv) {
  long long res = 0;
  if (rmv == 0) {
    int first = 0;
    int cnt = 0;
    for (int j = 0; j < (int)v.size(); j++) cnt += v[j];
    first = cnt - v[0];
    res = first * fact[cnt - 1];
    for (int j = 0; j < (int)v.size(); j++) {
      res /= fact[v[j]];
    }
    return res;
  }
  if (i == (int)v.size()) return 0;
  res += solve(v, i + 1, rmv);
  for (int r = 1; r <= rmv; r++) {
    v[i]--;
    if (v[i] <= 0) break;
    res += solve(v, i + 1, rmv - r);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  fact[0] = 1;
  for (int i = 1; i <= 18; i++) fact[i] = fact[i - 1] * i;
  string s;
  cin >> s;
  int freq[10] = {};
  int cnt = 0;
  int n = (int)s.size();
  for (int i = 0; i < n; i++) freq[s[i] - '0']++;
  for (int i = 0; i <= 9; i++) cnt += (freq[i] > 0);
  vector<int> v;
  for (int i = 0; i <= 9; i++) v.push_back(freq[i]);
  long long ans = 0;
  for (int rm = 0; rm <= n - cnt; rm++) {
    ans += solve(v, 0, rm);
  }
  cout << ans << '\n';
  return 0;
}
