PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000103. Phân phối thừa số để tối đa ƯCLN (Iks)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Phân phối thừa số để tối đa ƯCLN (Iks)

Iks

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

Given a sequence of nn positive integers, one operation selects two distinct positions and a prime pp dividing the first element. Divide that element by pp and multiply the other by pp. Repeat any number of operations. The sequence score is its GCD. Find the maximum possible score and the minimum number of operations needed to reach that score.

Input

The first line contains nn. The second line contains nn positive integers aia_i.

Output

Print two integers: the maximum achievable GCD and the minimum number of operations to reach it.

Subtasks

  • Subtask 1 (20 points): 1≤n≤101\le n\le 10, 1≤ai≤2001\le a_i\le 200.
  • Subtask 2 (30 points): 1≤n≤501\le n\le 50, 1≤ai≤1041\le a_i\le 10^4.
  • Subtask 3 (50 points): 1≤n≤1001\le n\le 100, 1≤ai≤1061\le a_i\le 10^6.

Examples

Input

3
4 4 1

Output

2 1

Explanation

The total exponent of prime 22 is 44, so each of three numbers can receive at least one factor 22; the maximum GCD is 22. Move one factor 22 from a 44 to the 11, producing 2,4,22,4,2 in one operation.