#include <bits/stdc++.h>
using namespace std;
int main() {
  long long j, n, fact[20], with0, without0, res;
  int i[10], d[10];
  fact[0] = 1;
  for (j = 1; j < 20; j++) {
    fact[j] = fact[j - 1] * j;
  }
  memset(d, 0, sizeof d);
  cin >> n;
  while (n > 0) {
    d[n % 10]++;
    n /= 10;
  }
  res = 0;
  for (i[0] = 0; i[0] <= d[0]; i[0]++) {
    if (i[0] == 0 && d[0] > 0) continue;
    for (i[1] = 0; i[1] <= d[1]; i[1]++) {
      if (i[1] == 0 && d[1] > 0) continue;
      for (i[2] = 0; i[2] <= d[2]; i[2]++) {
        if (i[2] == 0 && d[2] > 0) continue;
        for (i[3] = 0; i[3] <= d[3]; i[3]++) {
          if (i[3] == 0 && d[3] > 0) continue;
          for (i[4] = 0; i[4] <= d[4]; i[4]++) {
            if (i[4] == 0 && d[4] > 0) continue;
            for (i[5] = 0; i[5] <= d[5]; i[5]++) {
              if (i[5] == 0 && d[5] > 0) continue;
              for (i[6] = 0; i[6] <= d[6]; i[6]++) {
                if (i[6] == 0 && d[6] > 0) continue;
                for (i[7] = 0; i[7] <= d[7]; i[7]++) {
                  if (i[7] == 0 && d[7] > 0) continue;
                  for (i[8] = 0; i[8] <= d[8]; i[8]++) {
                    if (i[8] == 0 && d[8] > 0) continue;
                    for (i[9] = 0; i[9] <= d[9]; i[9]++) {
                      if (i[9] == 0 && d[9] > 0) continue;
                      n = 0;
                      for (j = 0; j < 10; j++) {
                        n += i[j];
                      }
                      with0 = fact[n];
                      for (j = 0; j < 10; j++) {
                        with0 /= fact[i[j]];
                      }
                      without0 = 0;
                      if (i[0] > 0) {
                        n = i[0] - 1;
                        for (j = 1; j < 10; j++) {
                          n += i[j];
                        }
                        without0 = fact[n] / fact[i[0] - 1];
                        for (j = 1; j < 10; j++) {
                          without0 /= fact[i[j]];
                        }
                      }
                      res += (with0 - without0);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  cout << res << endl;
}
