import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); HashMap map = new HashMap<>(); for (char c : arr) { if (map.containsKey(c)) { map.put(c, map.get(c) + 1); } else { map.put(c, 1); } } long base = kaijo(arr.length); for (int x : map.values()) { base /= kaijo(x); } System.out.println(base - 1); } static long kaijo(long x) { if (x <= 1) { return 1; } else { return x * kaijo(x - 1); } } }