#P3499. [POI 2010] NAJ-Divine Divisor

    ID: 2553 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学2010POI素数判断,质数,筛法

[POI 2010] NAJ-Divine Divisor

Description

An integer N>1N > 1 is given. We say that an integer d>1d > 1 is a divisor of NN with multiplicity k>0k > 0 (kk is integer) if dkNd^k \mid N and dk+1d^{k+1} does not divide NN. For example, the number N=18=163N = 18 = 16 \cdot 3 has the following divisors: 2 with multiplicity 4, 3 with multiplicity 1, 4 with multiplicity 2, 6 with multiplicity 1, and so on.

We say that a number dd is a divine divisor of the number NN if dd is a divisor of NN with multiplicity kk and NN has no divisors with multiplicities greater than kk. For example, the sole divine divisor of 48 is 2 (with multiplicity 4), and the divine divisors of 6 are: 2, 3 and 6 (each with multiplicity 1).

Your task is to determine the multiplicity of divine divisors of NN and the number of its divine divisors.

Input

Output

Example

For the input data:

3
4 3 4

the correct result is:

4
1

whereas for the input:

1
6

the correct result is:

1
3

Grading

Should your program print out the correct multiplicity kk of a divine divisor of NN, but fail to print in the second line the correct number DD of divine divisors of NN (or fail to print that number at all), it will be awarded 50% of the score for that particular test, scaled accordingly if it exceeds half the time limit.

Input Format

The number NN is given on the standard input, though in a somewhat unusual way. The first line holds a single integer nn (1n6001 \le n \le 600). The second line holds nn integers aia_i (2ai10182 \le a_i \le 10^{18}) separated by single spaces. These denote that N=a1a2anN = a_1 \cdot a_2 \cdot \dots \cdot a_n.

Output Format

The first line of the standard output should hold the maximum integer kk such that there exists a divisor dd of NN such that dkNd^k \mid N. The second line should hold a single integer DD that is the number of (divine) divisors of NN with multiplicity kk.

3
4 3 4
4
1
1
6
1
3

Hint

Should your program print out the correct multiplicity kk of a divine divisor of NN, but fail to print in the second line the correct number DD of divine divisors of NN (or fail to print that number at all), it will be awarded 50% of the score for that particular test.

Task author: Jakub Radoszewski.