#include <bits/stdc++.h>
using namespace std;
char s[35];
int num[15];
long long sum = 0;
long long a[34];
void init() {
  a[0] = 1, a[1] = 1;
  for (int i = 2; i <= 19; i++) {
    a[i] = a[i - 1] * i;
  }
}
int vis[15];
int flag = 0;
void dfs(int i, long long v, long long vv) {
  int f = 0, now = 0;
  for (int j = i; j <= 9; j++) {
    if (vis[j] || !num[j]) continue;
    f = 1;
    vis[j] = 1;
    for (int k = 1; k <= num[j]; k++) dfs(i + 1, v + k, vv * a[k]);
    vis[j] = 0;
    return;
  }
  if (!f) {
    v = a[v] / vv;
    sum += v;
  }
}
int main() {
  init();
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    num[s[i] - '0']++;
  }
  for (int i = 1; i <= 9; i++) {
    if (num[i]) {
      vis[i] = 1;
      for (int k = 0; k < num[i]; k++) dfs(0, k, a[k]);
      vis[i] = 0;
    }
  }
  printf("%lld\n", sum);
  return 0;
}
