import std.stdio, std.string, std.conv, std.range, std.math, std.bigint, std.algorithm, core.bitop; void main() { auto S = readln.strip.array.sort(); long ans; do { ans++; } while (S.nextPermutation); (ans - 1).writeln; }