#include <bits/stdc++.h>
using namespace std;
int long long n, i, j, ans, d[10], l, r;
string s;
void rec(vector<int> v) {
  int i = v.size();
  if (i == 10) {
    long long c1 = 0;
    for (int j = 1; j < v.size(); j++) {
      c1 += v[j];
    }
    if (c1 == 0) {
      return;
    }
    long long g = c1 + v[0] - 1, c2 = 1;
    while (g) {
      c2 *= g;
      g--;
    }
    c1 *= c2;
    for (int j = 0; j < v.size(); j++) {
      for (int h = 2; h <= v[j]; h++) {
        c1 /= h;
      }
    }
    ans += c1;
    return;
  }
  for (int j = 0; j <= d[i]; j++) {
    if (d[i] && j == 0) {
      continue;
    }
    v.push_back(j);
    rec(v);
    v.pop_back();
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> s;
  n = s.size();
  for (i = 0; i < n; i++) {
    d[s[i] - '0']++;
  }
  vector<int> v;
  rec(v);
  cout << ans;
}
