#include <bits/stdc++.h>
using namespace std;
char s[29];
long long ans, tem, sum, fc[29];
int i, n, a[10], i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
int main() {
  for (fc[0] = i = 1; i < 29; ++i) fc[i] = fc[i - 1] * i;
  for (scanf("%s", s), i = 0; s[i]; ++i) ++a[s[i] - '0'];
  for (i0 = (bool)a[0]; i0 <= a[0]; ++i0)
    for (i1 = (bool)a[1]; i1 <= a[1]; ++i1)
      for (i2 = (bool)a[2]; i2 <= a[2]; ++i2)
        for (i3 = (bool)a[3]; i3 <= a[3]; ++i3)
          for (i4 = (bool)a[4]; i4 <= a[4]; ++i4)
            for (i5 = (bool)a[5]; i5 <= a[5]; ++i5)
              for (i6 = (bool)a[6]; i6 <= a[6]; ++i6)
                for (i7 = (bool)a[7]; i7 <= a[7]; ++i7)
                  for (i8 = (bool)a[8]; i8 <= a[8]; ++i8)
                    for (i9 = (bool)a[9]; i9 <= a[9]; ++i9) {
                      n = i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9,
                      ans = fc[n], tem = fc[n - (bool)i0];
                      ans /= fc[i0], tem /= fc[i0 - (bool)i0];
                      ans /= fc[i1], tem /= fc[i1];
                      ans /= fc[i2], tem /= fc[i2];
                      ans /= fc[i3], tem /= fc[i3];
                      ans /= fc[i4], tem /= fc[i4];
                      ans /= fc[i5], tem /= fc[i5];
                      ans /= fc[i6], tem /= fc[i6];
                      ans /= fc[i7], tem /= fc[i7];
                      ans /= fc[i8], tem /= fc[i8];
                      ans /= fc[i9], tem /= fc[i9];
                      sum += ans - tem * (bool)i0;
                    }
  printf("%I64d\n", sum), exit(0);
}
