#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
long long jc[20];
vector<int> appear(10);
void dfs(int num, vector<int> cur) {
  if (num == 10) {
    int sum = 0;
    for (int i = 0; i < cur.size(); i++) sum += cur[i];
    long long tmp = jc[sum];
    for (int i = 0; i < cur.size(); i++) tmp = tmp / jc[cur[i]];
    if (cur[0] > 0) {
      tmp -= tmp * cur[0] / sum;
    }
    ans += tmp;
    return;
  }
  for (int i = 1; i <= appear[num]; i++) {
    cur[num] = i;
    dfs(num + 1, cur);
  }
  if (appear[num] == 0) dfs(num + 1, cur);
}
int main() {
  string str;
  cin >> str;
  for (int i = 0; i < str.size(); i++) appear[str[i] - '0']++;
  vector<int> cur(10);
  jc[0] = 1;
  for (int i = 1; i <= 19; i++) jc[i] = i * jc[i - 1];
  dfs(0, cur);
  cout << ans << endl;
  return 0;
}
