Олимпиадный тренинг

Задача 39249. Goshin sequence


Math lover Gosha came up with his own sequence. The rules in its sequence are:
1) all numbers in the sequence have their own number;
2) the first element of the sequence has number 1;
3) each number in the sequence must be divisible by its number;
4) the number with the larger number must be greater than the number with the smaller number.

An example of Gosha's sequence: 1 4 6 8 10 18 21.

Given a set of numbers, determine what is the maximum number of numbers that can be chosen to make the Goshin sequence, and also what is the maximum number that can be in it.


Input
The first line contains the number N - the number of numbers in the file (N <= 105). Next comes N natural numbers (no more than 106), each on a separate line.

Input
Print two space-separated numbers: first, the maximum number of numbers that can be chosen to make the Goshin sequence, then the maximum number that can be in this sequence.

 
Examples
# Input Output
1 12
25
17
20
15
6
9
10
12
5
3
4
1
5 25