#P3499. Divine Divisors

    ID: 16753 Type: Default 1000ms 256MiB

Divine Divisors

Divine Divisors

You are given a positive integer m and a sequence of m positive integers \(a_1, a_2, \dots, a_m\). Let \(n = \prod_{i=1}^{m} a_i\). For any integer \(d > 1\), we say that \(d\) is a divisor of \(n\) with multiplicity \(k\) if and only if:

\[ d^k \mid n \quad \text{and} \quad d^{k+1} \nmid n, \]

Furthermore, \(d\) is called a divine divisor of \(n\) if it is a divisor of \(n\) with multiplicity \(k\) and there is no divisor of \(n\) with multiplicity greater than \(k\>.

Your task is to determine the maximum multiplicity \(k_{\max}\) that can be achieved by some divisor \(d > 1\) of \(n\) and, in the case when the multiplicity is \(k_{\max}\), find the number of such divisors.

Explanation: For every divisor \(d > 1\) of \(n\), if we write its prime factorization as \(d = \prod_{p \in P} p^{f_p}\) and \(n\) has the prime factorization \(n = \prod_{p \in P} p^{a_p}\), then the multiplicity of \(d\) is defined as:

\[ k(d) = \min_{p \mid d} \left\lfloor \frac{a_p}{f_p} \right\rfloor. \]

It can be shown that the maximum possible multiplicity \(k_{\max}\) is achieved by choosing a divisor that is a prime (with its exponent equal to 1) among those primes which appear in \(n\) with the highest exponent. In other words, if \(r\) is the number of primes for which \(a_p = k_{\max}\), then the number of divine divisors is \(2^r - 1\) (i.e. all non-empty products of these primes).

inputFormat

The input begins with an integer m (\(1 \le m\)). The next line contains m positive integers \(a_1, a_2, \dots, a_m\) separated by spaces.

It is guaranteed that \(n = \prod_{i=1}^{m} a_i\) fits within the constraints implied by the input.

outputFormat

Output two integers separated by a space: the first is the maximum multiplicity \(k_{\max}\) and the second is the number of divisors \(d > 1\) that achieve this maximum multiplicity.

sample

2
6 8
4 1