#include <bits/stdc++.h>
using namespace std;
const int MAXN = 21;
long long freq[10], aux[10], ans = 0, sm = 0;
long long fat(long long x) {
  if (x <= 1) return 1LL;
  return x * fat(x - 1);
}
void gen(int idx) {
  if (idx == 10) {
    long long auxx = fat(sm - 1) * (sm - aux[0]);
    for (int i = 0; i < 10; i++) auxx = auxx / fat(aux[i]);
    ans += auxx;
    return;
  }
  for (int j = 1; j <= freq[idx]; j++) {
    aux[idx] = j;
    sm = sm + j;
    gen(idx + 1);
    sm = sm - j;
  }
  if (freq[idx] == 0) gen(idx + 1);
}
int main() {
  long long n;
  cin >> n;
  while (n > 0) {
    int cur = n % 10;
    freq[cur]++;
    n = n / 10;
  }
  gen(0);
  cout << ans << endl;
}
