Little Gyro and Sequences
题号:NC200117
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Little Gyro has just found an integer sequence a_1,a_2,...,a_n in his left pocket. As Little Gyro is bored, he decides to delete some elements from the sequence.
However, Little Gyro's father, Mr.Potato, is aware of Little Gyro's attitude, so he gives Little Gyro a task to do. The problem is how to delete some strictly increasing subsequences from his left pocket within the least operations as well as containing the most elements until his left pocket is empty.
Now given an integer sequence, and within his father's command, Little Gyro is ready to delete the sequence. Could you help him to find the number of subsequences at least and the number of the elements for the longest subsequence at most?
For example, let's consider the sequence [1,2,3]. All the subsequences of [1,2,3] are [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3].
And the sequence [1,2,3] is a strictly increasing subsequence. However, [1,1,2], [3,1,2] are not.

输入描述:

Each input file only contains one test case.
The first line contains an integer n (1 ≤ n ≤ 2×), indicating the length of the sequence.
The second line contains n integers a_1,a_2,...,a_n (1 ≤ a_i), indicating the given sequence.

输出描述:

For each test case output two integers, indicating the number of the elements for the longest subsequence and the number of subsequences Little Gyro will delete at least.
示例1

输入

复制
5
1 2 2 3 1

输出

复制
3 3
示例2

输入

复制
5
1 1 1 1 1

输出

复制
1 5

说明

For the first sample, Little Gyro can delete 3 subsequences [1,2,3], [2], [1] at least, the length of  the longest subsequence is 3, so the answer is 3 3.
For the second sample, Little Gyro only can delete subsequence [1] for 5 times.