Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

C. Matrix Walk

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThere is a matrix *A* of size *x* × *y* filled with integers. For every , *A*_{i, j} = *y*(*i* - 1) + *j*. Obviously, every integer from [1..*xy*] occurs exactly once in this matrix.

You have traversed some path in this matrix. Your path can be described as a sequence of visited cells *a*_{1}, *a*_{2}, ..., *a*_{n} denoting that you started in the cell containing the number *a*_{1}, then moved to the cell with the number *a*_{2}, and so on.

From the cell located in *i*-th line and *j*-th column (we denote this cell as (*i*, *j*)) you can move into one of the following cells:

- (
*i*+ 1,*j*) — only if*i*<*x*; - (
*i*,*j*+ 1) — only if*j*<*y*; - (
*i*- 1,*j*) — only if*i*> 1; - (
*i*,*j*- 1) — only if*j*> 1.

Notice that making a move requires you to go to an adjacent cell. It is not allowed to stay in the same cell. You don't know *x* and *y* exactly, but you have to find any possible values for these numbers such that you could start in the cell containing the integer *a*_{1}, then move to the cell containing *a*_{2} (in one step), then move to the cell containing *a*_{3} (also in one step) and so on. Can you choose *x* and *y* so that they don't contradict with your sequence of moves?

Input

The first line contains one integer number *n* (1 ≤ *n* ≤ 200000) — the number of cells you visited on your path (if some cell is visited twice, then it's listed twice).

The second line contains *n* integers *a*_{1}, *a*_{2}, ..., *a*_{n} (1 ≤ *a*_{i} ≤ 10^{9}) — the integers in the cells on your path.

Output

If all possible values of *x* and *y* such that 1 ≤ *x*, *y* ≤ 10^{9} contradict with the information about your path, print NO.

Otherwise, print YES in the first line, and in the second line print the values *x* and *y* such that your path was possible with such number of lines and columns in the matrix. Remember that they must be positive integers not exceeding 10^{9}.

Examples

Input

8

1 2 3 6 9 8 5 2

Output

YES

3 3

Input

6

1 2 1 2 5 3

Output

NO

Input

2

1 10

Output

YES

4 9

Note

The matrix and the path on it in the first test looks like this:

Also there exist multiple correct answers for both the first and the third examples.

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/23/2018 11:33:55 (d3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|