#include <bits/stdc++.h>
using namespace std;
long long ans, sil[100], ss[100], n, cnt[100], dwu[30][30];
string s;
long long licz(long long *set) {
  long long all = 0;
  for (int a = 0; a < 10; a++) all += *(set + a);
  long long res = dwu[all - 1][*set];
  all -= *set;
  for (int a = 1; a < 10; a++) {
    res *= dwu[all][*(set + a)];
    all -= *(set + a);
  }
  return res;
}
void go(int i, long long *set) {
  if (i == 10) {
    ans += licz(set);
    return;
  }
  if (!cnt[i]) go(i + 1, set);
  for (int a = 1; a <= cnt[i]; a++) {
    *(set + i) = a;
    go(i + 1, set);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  dwu[0][0] = 1;
  for (int a = 1; a <= 20; a++) dwu[a][0] = 1;
  for (int a = 1; a <= 20; a++) {
    for (int b = 1; b <= 20; b++) {
      dwu[a][b] = dwu[a - 1][b - 1] + dwu[a - 1][b];
    }
  }
  n = s.size();
  for (int a = 0; a < s.size(); a++) {
    cnt[s[a] - '0']++;
  }
  go(0, ss);
  cout << ans << endl;
  return 0;
}
