After decrypting the code Enigma crew came to know that there are N locations where bombs has been planted. X1, X2 …. Xn are the N locations. Among this locations, one X location is the central hub which control all the other Xn-1 location. 1 or more than 1 signal is send to N locations. The decrypted code simplified  that the X location is not divisible from the range 2 to X/2. 

Your job is to help the Enigma crew by finding the largest X location and how many times it is repeated. So, the Enigma crew can defuse the main hub.

Input Format
The first line contains a single integer, N, representing the number of locations.
In the second line, there are N space-separated integers X1, X2 …..Xn, representing the location of N.  

Output Format
There will be two line of output.
First line contain the largest X location.
Second line contain the number of times is repeated. 

Constraints
1 ≤ N ≤ 100000
1 ≤ X ≤ 1000000

SAMPLE INPUT
10
1 3 5 17 21 17 5 11 10 40

SAMPLE OUTPUT
17
2
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def is_prime(n):
    #if n % 2 == 0 and n > 2: 
    #    return False
    for i in range(2,n/2):
        if n % i == 0:
            return False
    return True

size = int(raw_input())
arr = map(int, raw_input().split())
arr.sort()
arr.reverse()
#print arr
count = 0
x=0
for i in arr:	
	if count > 0:
		if i == x:
			count = count + 1
		else:
			break
	else:
		if is_prime(i):
			count =1
			x = i
print x
print count