#include <bits/stdc++.h>
using namespace std;
int dig[20] = {0}, len = 0, sum = 0, now, app;
long long c[20][20] = {1};
void get() {
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    ;
  for (; c >= '0' && c <= '9'; c = getchar()) ++dig[c - '0'];
}
template <class T>
void show(T *x, int len, int s = 0) {
  for (int i = s; i < s + len; ++i) cout << x[i] << ' ';
  cout << endl;
}
long long dfs(int x, int res) {
  if (x == 10 && res) return 0;
  if (x == 10 && app != sum) return 0;
  if (x == 10) return 1;
  long long ans = 0;
  if (dig[x]) {
    if (x != now) {
      ++app;
      for (int i = 1; i <= dig[x] && i <= res; ++i)
        ans += dfs(x + 1, res - i) * c[res][i];
      --app;
    } else
      for (int i = 0; i <= dig[x] && i <= res; ++i)
        ans += dfs(x + 1, res - i) * c[res][i];
  } else
    ans += dfs(x + 1, res);
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  get();
  for (int i = 0; i < 10; ++i) {
    if (dig[i]) {
      ++sum;
      len += dig[i];
    }
  }
  for (int i = 1; i < 20; ++i) {
    c[i][0] = 1;
    for (int j = 1; j <= i; ++j) c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
  }
  long long ans = 0;
  for (int i = sum; i <= len; ++i)
    for (int j = 1; j < 10; ++j)
      if (dig[j]) {
        --dig[j];
        now = j;
        app = 1;
        ans += dfs(0, i - 1);
        ++dig[j];
      }
  cout << ans << endl;
  return 0;
}
