#include <bits/stdc++.h>
using namespace std;
const int MOD = 786433, MAXN = 100005, LOGN = 18, MAXM = 5005;
inline void S(int& n) {
  n = 0;
  int ch = getchar();
  int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    n = (n << 3) + (n << 1) + ch - '0', ch = getchar();
  }
  n = n * sign;
}
const int SHIFT = 30, ETF = MOD - 1, LIM = (int)1e9;
const long long int INF = (long long int)1e18 + 1;
const double PI = (double)acos(-1), EPSILON = 1e-10;
int digits[10];
long long int fact[21];
void splitNumber(long long int n) {
  while (n) {
    int d = n % 10;
    digits[d]++;
    n /= 10;
  }
}
long long int recurse(vector<int> arr, int idx, bool zero) {
  if (idx == arr.size()) {
    int cnt = 0;
    for (int i = 0; i < arr.size(); i++) {
      cnt += arr[i];
    }
    long long int temp;
    if (zero) {
      temp = cnt - arr[0];
    } else {
      temp = cnt;
    }
    cnt--;
    temp *= fact[cnt];
    for (int i = 0; i < arr.size(); i++) {
      temp /= fact[arr[i]];
    }
    return temp;
  }
  long long int ans = 0;
  vector<int> newvec(arr);
  for (int i = 1; i < arr[idx] + 1; i++) {
    newvec[idx] = i;
    ans += recurse(newvec, idx + 1, zero);
  }
  return ans;
}
void pre() {
  fact[0] = 1;
  for (int i = 1; i < 21; i++) {
    fact[i] = (i * fact[i - 1]);
  }
}
int main() {
  pre();
  long long int n;
  cin >> n;
  splitNumber(n);
  vector<int> arr;
  for (int i = 0; i < 10; i++) {
    if (digits[i]) arr.push_back(digits[i]);
  }
  bool zero = false;
  if (digits[0]) zero = true;
  if (0) {
    cout << "array "
         << "digits"
         << ":" << endl;
    for (int ij = 0; ij < 10; ij++) cout << ij << ". " << digits[ij] << endl;
    cout << endl;
    cout << "array "
         << "fact"
         << ":" << endl;
    for (int ij = 0; ij < 21; ij++) cout << ij << ". " << fact[ij] << endl;
    cout << endl;
    cout << "zero"
         << "=" << zero << endl;
    cout << "array "
         << "arr"
         << ":" << endl;
    for (int ij = 0; ij < arr.size(); ij++)
      cout << ij << ". " << arr[ij] << endl;
    cout << endl;
  }
  cout << recurse(arr, 0, zero) << endl;
  return 0;
}
