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]").array; int[] primeFactors(int n) { auto pi = new int[](s.length + 1); auto p = 2; while (n > 1) { if (n % p == 0) { pi[p] += 1; n /= p; } else { p += (p == 2 ? 1 : 2); } } return pi; } auto pi = new int[](s.length + 1); foreach (i; 1..s.length + 1) pi[] += primeFactors(i.to!int)[]; foreach (g; gi) foreach (h; 1..g + 1) pi[] -= primeFactors(h)[]; auto r = 1; foreach (i, p; pi) foreach (_; 0..p) r = (r * i) % mod; writeln(r == 0 ? mod - 1 : r - 1); }