#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
long long fact[20];
long long num[15];
long long ans;
long long tot;
char s[100];
int use[10];
void dfs(int x, int now) {
  if (x == 10) {
    int t = 0;
    int y = 0;
    for (int i = 0; i < 10; ++i) {
      t += use[i];
      if (use[i]) y++;
    }
    long long tmp = 1;
    for (int i = 1; i <= t; ++i) tmp *= i;
    for (int i = 0; i < 10; ++i) {
      for (int j = 1; j <= use[i]; ++j) tmp /= j;
    }
    ans += tmp;
    return;
  }
  if (!num[x]) {
    use[x] = 0;
    dfs(x + 1, now);
    return;
  }
  for (int i = (x == now) ? 0 : 1; i <= num[x]; ++i) {
    use[x] = i;
    dfs(x + 1, now);
  }
}
int main() {
  fact[0] = 1;
  for (int i = 1; i <= 18; i++) fact[i] = fact[i - 1] * (long long)i;
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = 1; i <= n; i++) num[s[i] - '0']++;
  for (int i = 0; i <= 9; i++) {
    if (num[i]) {
      tot++;
    }
  }
  int tmp = tot;
  for (int i = 1; i <= 9; i++) {
    if (!num[i]) continue;
    num[i]--;
    dfs(0, i);
    num[i]++;
  }
  cout << ans << endl;
}
