#include <bits/stdc++.h>
using namespace std;
long long num[20], nownum[20], f[20];
long long ans = 0;
long long jc() {
  long long h = 0;
  for (int i = 0; i < 10; i++) {
    h += nownum[i];
  }
  h = f[h];
  for (int i = 0; i < 10; i++) {
    h /= f[nownum[i]];
  }
  return h;
}
void dfs(int shu) {
  if (shu > 9) {
    ans += jc();
    if (nownum[0] >= 1) {
      nownum[0]--;
      ans -= jc();
      nownum[0]++;
    }
    return;
  }
  if (num[shu]) {
    for (int i = 1; i <= num[shu]; i++) nownum[shu] = i, dfs(shu + 1);
  } else
    dfs(shu + 1);
}
int main() {
  string a;
  cin >> a;
  memset(num, 0, sizeof(num));
  memset(nownum, 0, sizeof(nownum));
  for (int i = 0; i < a.size(); i++) {
    num[a[i] - '0']++;
  }
  f[0] = 1;
  for (int i = 1; i < 20; i++) f[i] = i * f[i - 1];
  dfs(0);
  cout << ans << endl;
}
