Some Complex Formulas#11676

Some Complex Formulas

1 second
256 megabytes
Medium

You are given an integer and an array a_1, a_2, \dots, a_n consisting of integers.

The subarray of the array beginning at and ending at is a segment of numbers a_i, a_{i+1}, \dots, a_j. Let this subarray be nice if

GCD(a_i, a_{i+1}, \dots, a_j) = \frac{\sum_{k=i}^j a_k}{j - i + 1}

That is, if the greatest common divisor of numbers a_i, a_{i+1}, \dots, a_j equals their arithmetic mean.

Your task is to find the number of different pairs of integers (1 \le i \le j \le n) such that subarray a_i, a_{i+1}, \dots, a_j is nice. Also, you need to find the maximum length of a nice subarray of .

Input

The first line contains one integer (1 \le n \le 10^5) — the number of elements in the array .

The second line contains integers a_1, a_2, \dots, a_n (1 \le a_i \le 10^9) — the elements of the array.

Output

In the only line, you need to output the number of nice subarrays of the array and the length of the longest such subarray.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading

Note

In the first example, there are subarrays in total: , , , , and .

Subarray is nice because GCD(a_1) = a_1 = \frac{a_1}{1}.

Subarray is not nice because GCD(a_2,a_3) = GCD(3,2) = 1 \neq \frac{a_2+a_3}{2} = \frac{3+2}{2} = 2.5.

There are exactly 3 nice subarrays in this array: , , and all these subarrays have lengths of .

Scoring

  1. ( points): n \le 200;

  2. ( points): n \le 2\,000;

  3. ( points): no additional constraints.