#include <bits/stdc++.h>
using namespace std;
const int maxn = 19;
int n;
string s;
long long dp[1 << maxn];
bool mrk[10];
long long f(int mask) {
  int i = __builtin_popcount(mask);
  if (dp[mask] == -1) {
    if (i >= n) return dp[mask] = 1;
    dp[mask] = 0;
    bool ok[10];
    int pos[10];
    for (int k = 0; k < 10; ++k) {
      ok[k] = false;
      pos[k] = -1;
    }
    for (int k = 0; k < n; ++k)
      if ((1 << k) & mask)
        ok[s[k] - '0'] = true;
      else
        pos[s[k] - '0'] = k;
    bool flag = true;
    for (int k = 0; k < 10; ++k)
      if (mrk[k] && !ok[k]) flag = false;
    if (flag) dp[mask] = 1;
    for (int k = 0; k < 10; ++k) {
      if (!i && !k) continue;
      if (pos[k] == -1) continue;
      dp[mask] += f(mask + (1 << pos[k]));
    }
  }
  return dp[mask];
}
long long solve() {
  n = (int)s.size();
  sort(s.begin(), s.end());
  for (int i = 0; i < s.size(); ++i) mrk[s[i] - '0'] = true;
  memset(dp, -1, sizeof(dp));
  return f(0);
}
int main() {
  cin.sync_with_stdio(false);
  cin >> s;
  cout << solve() << '\n';
  return 0;
}
