#include <bits/stdc++.h>
using namespace std;
const int mn = 25;
const double eps = 1e-1;
int n;
char s[mn];
int up[mn];
int now[mn];
long long ans;
bool getnext() {
  bool flag = 0;
  for (int i = 9; i >= 0; i--) {
    if (up[i] == 0) continue;
    if (up[i] > now[i]) {
      now[i]++;
      return 1;
    } else {
      now[i] = 1;
      flag = 1;
    }
  }
  if (flag) return 0;
}
long long solve(int now[]) {
  int sz = 0;
  for (int i = 0; i < 10; i++) sz += now[i];
  long long u = 1;
  for (int i = 2; i <= sz; i++) u = u * i;
  for (int i = 0; i < 10; i++) {
    for (int j = 2; j <= now[i]; j++) {
      u /= j;
    }
  }
  if (now[0]) {
    int temp[mn];
    for (int k = 1; k <= now[0]; k++) {
      for (int i = 0; i < 10; i++) {
        temp[i] = now[i];
      }
      temp[0] -= k;
      u -= solve(temp);
    }
  }
  return u;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) {
    up[s[i] - '0']++;
  }
  for (int i = 0; i < 10; i++) {
    if (up[i]) now[i] = 1;
  }
  do {
    long long u = solve(now);
    ans += u;
  } while (getnext());
  cout << ans << endl;
  return 0;
}
