#include <bits/stdc++.h>
using namespace std;
long long d[1000009];
string s;
int n;
vector<int> v;
bool ch(int x) {
  for (auto pp : v) {
    if (x & (1 << pp)) continue;
    return 0;
  }
  return 1;
}
long long dp(int x) {
  if (d[x] != -1) return d[x];
  if (x == 1 && s[0] == '0') return 0;
  long long u = 0;
  if (ch(x)) {
    u++;
  }
  for (int i = 0; i < n; i++) {
    if ((x & (1 << i))) continue;
    if (i == 0 || (s[i] != s[i - 1])) {
      u += dp(x + (1 << i));
    }
    if (i && s[i - 1] == s[i] && ((x & (1 << (i - 1))) != 0)) {
      u += dp(x + (1 << i));
    }
  }
  d[x] = u;
  return u;
}
int main() {
  memset(d, -1, sizeof d);
  cin >> s;
  v.push_back(0);
  n = s.size();
  sort(s.begin(), s.end());
  for (int i = 1; i < n; i++) {
    if (s[i] != s[i - 1]) v.push_back(i);
  }
  cout << dp(0);
}
