#include <bits/stdc++.h>
using namespace std;
long long fre[11];
long long fato[21];
long long fat(long long n) {
  if (n == 1 || n == 0) return 1;
  if (fato[n] != 0) return fato[n];
  return fato[n] = n * fat(n - 1);
}
long long ways(vector<long long> freq, long long size) {
  long long respar = fat(size);
  for (long long i = 0; i < freq.size(); i++) {
    respar = respar / fat(freq[i]);
  }
  return respar;
}
long long sw(vector<long long> freq, long long size) {
  long long resp = 0;
  if (freq[0] == 0) return ways(freq, size);
  for (long long i = 1; i < freq.size(); i++) {
    if (freq[i] != 0) {
      vector<long long> aux = freq;
      aux[i]--;
      resp += ways(aux, size - 1);
    }
  }
  return resp;
}
long long solve(long long i, vector<long long> freq, long long size) {
  long long ans = 0;
  if (i == 10) return sw(freq, size);
  if (fre[i] == 0) {
    freq.push_back(0);
    return solve(i + 1, freq, size);
  }
  for (long long j = 1; j <= fre[i]; j++) {
    vector<long long> aux = freq;
    aux.push_back(j);
    ans += solve(i + 1, aux, size + j);
  }
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(11);
  cout.setf(ios::fixed);
  string second;
  cin >> second;
  for (long long i = 0; i < second.size(); i++) {
    fre[second[i] - '0']++;
  }
  vector<long long> ini;
  cout << solve(0, ini, 0) << endl;
  return 0;
}
