There is a matrix A of size x × y filled with integers. For every $i \in [ 1 . . x ]$, $j \in [ 1 . . y ]$ 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: [Image] 

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

Difficulty: interview

Starter code:

Solutions:
MAXN = 1000000000

n = int(input())
a = list(map(int, input().split()))

def solve1():	
	for i in range(n-1):
		if abs(a[i]-a[i+1]) != 1:
			return False
	print("YES\n%d %d" % (MAXN, 1))
	return True

def solve2():
	w = -1
	for i in range(n-1):
		d = abs(a[i]-a[i+1])
		if d != 1:
			if w == -1:
				w = d
			elif w != d:
				return False
	if w <= 0:
		return False
	for i in range(n-1):
		if abs(a[i]-a[i+1]) == 1 and (a[i]-1)//w != (a[i+1]-1)//w:
			return False
	print("YES\n%d %d" % (MAXN, w))
	return True

if solve1():
	pass
elif solve2():
	pass
else:
	print("NO")

MAXN = 1000000000

n = int(input())
a = list(map(int, input().split()))

def solve1():	
	for i in range(n-1):
		if abs(a[i]-a[i+1]) != 1:
			return False
	print("YES\n%d %d" % (MAXN, 1))
	return True

def solve2():
	w = -1
	for i in range(n-1):
		d = abs(a[i]-a[i+1])
		if d != 1:
			if w == -1:
				w = d
			elif w != d:
				return False
	if w <= 0:
		return False
	for i in range(n-1):
		if abs(a[i]-a[i+1]) == 1 and (a[i]-1)//w != (a[i+1]-1)//w:
			return False
	print("YES\n%d %d" % (MAXN, w))
	return True

if solve1():
	pass
elif solve2():
	pass
else:
	print("NO")

n = int(input())
a = [int(x) for x in input().split()]

y = []
for s, t in zip(a, a[1:]):
    if abs(s - t) != 1 and s != t:
        y.append(abs(s - t))
y.append(1)
y = y[0]

for s, t in zip(a, a[1:]):
    if not(abs(s - t) == y or (abs(s - t) == 1 and min(s, t) % y != 0)):
        break
else:
    print("YES")
    print("{} {}".format(10**9, y))
    return

print("NO")


n = int(input())
walk = list(map(int, input().split()))
MAXN = 1000000000
def solve1():
    for i in range(n-1):
        if abs(walk[i+1]-walk[i]) != 1:
            return False
    print("YES")
    print(MAXN, 1)
    return True

def solve2():
    colum = -1
    for i in range(n-1):
        diff = abs(walk[i+1]-walk[i])
        if diff != 1:
            if colum == -1:
                colum = diff
            elif colum != diff:
                return False
    if colum<=0:
        return False
    for i in range(n-1):
        if abs(walk[i+1]-walk[i]) == 1 and ((walk[i+1]-1)//colum != (walk[i]-1)//colum):
            return False
    print("YES")
    print(MAXN,colum)
    return True

if solve1():
    pass
elif solve2():
    pass
else:
    print("NO")

n = int(input())
a = list(map(int,input().split()))
x = 1
y = 10**9
if n == 1:
    print('YES')
    print(y,x)
else:
    t = 0
    for i in range(1,n):
        s = a[i]-a[i-1]
        if s != 1 and s != -1:
            s = max(s,-s)
            if (x != 1 and x != s) or s == 0:
                print('NO')
                t = 1
                break
            x = s
    if t == 0 and x > 1:
        for i in range(1,n):
            if (a[i] % x == 0 and a[i-1] == a[i]+1) or (a[i-1] % x == 0 and a[i] == a[i-1]+1):
                print('NO')
                t = 1
                break
    if t == 0:
        print('YES')
        print(y,x)

while True:
    n = int(input())
    path = list(map(int, input().split()))

    eleminatedY = {1}
    y = 1

    for i in range(n - 1):

        diff = abs(path[i] - path[i + 1])

        if diff == 0:
            print("NO");return

        if diff == 1:
            eleminatedY.add(min(path[i], path[i + 1]))
            if min(path[i], path[i + 1]) % y == 0 and y != 1:
                print("NO");return
            continue

        if y == diff:
            continue

        for value in eleminatedY:
            if value % diff == 0:
                print("NO");return

        if y == 1:
            y = diff
            continue
        
        print("NO");return

    print("YES\n{} {}".format(1000000000, y))
            
    return


n=int(input())
m=list(map(int,input().split()))
x=1
from math import fabs
for i in range(1,n):
    if not (-1<=m[i]-m[i-1]<=1):
        x=int(fabs(m[i]-m[i-1]))
        break
for i in range(1,n):
        if not (fabs(m[i]-m[i-1])==x or (m[i]-1)//x==(m[i-1]-1)//x) or m[i-1]==m[i]:  
            print('NO')
            break
else:
    print('YES')
    print(10**9,x)