import java.io.*; import java.util.*; public class Main { static HashSet strings = new HashSet<>(); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); char[] input = sc.next().toCharArray(); search(0, input, new char[input.length], new boolean[input.length]); System.out.println(strings.size() - 1); } static void search(int idx, char[] input, char[] output, boolean[] used) { if (idx >= input.length) { strings.add(new String(output)); return; } for (int i = 0; i < input.length; i++) { if (used[i]) { continue; } used[i] = true; output[idx] = input[i]; search(idx + 1, input, output, used); used[i] = false; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }