import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random, core.bitop; import std.string, std.regex, std.conv, std.stdio, std.typecons; const auto mod = 573; void main() { auto s = readln.chomp.map!(to!int).array; s.sort(); auto gi = s.group.map!("a[1]").filter!("a > 1").array; auto ti = iota(1, s.length + 1).array; foreach (g; gi) { foreach (h; 1..g + 1) { foreach (ref t; ti) { if (t % h == 0) { t /= h; break; } } } } auto r = 1; foreach (t; ti) r = (r * t) % mod; writeln(r - 1); }