CALENTAMIENTO - La tarea

no tags 

Today Pispirito was a kind of logic for the first time, the teacher left a task he can not complete without your help. Pispirito has a vector of non-negative integers a1, a2 ... an. What you should do is, first, choose an integer x, then add x to some elements of the vector (not more than once), subtract x from some other elements (also, no more than once) and leave other elements unchanged, so that all vector elements are equal. Pispirito wonders if such an integer x exists?

Todo los algoritmos en Español www.dropbox.com/s/u0hc8ukm3iy4sk6/RETOS_MARATON_final_V1_2_2016.doc?dl=0.

Input

The first line of input contains an integer n (1 ≤ n ≤ 100 000) - the number of integers in the vector Pispirito. The second line contains n integers a1, a2 ... n (0 ≤ ai ≤ 109) - vector elements.

Output

If it is impossible for all elements of the vector are equal by the procedure specified in the problem statement, then print "NO" (without quotation marks) in the only line of output. Otherwise print "YES" (without quotation marks).

Example

Input:
5
1 3 3 2 1

Output:
Si
Input:
5
1 3 3 2 1

Output:
Si

Note: In the first example Pispirito must select x = 1, and then add it to the first and last element of the vector and subtracting the second and third elements.


hide comments
Simes: 2023-02-11 18:18:21

Si or Yes? NO or No? No users are AC, is there something wrong with the test data?


Added by:MaratónAFDM
Date:2016-11-04
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:MAWK BC C NCSHARP CSHARP C++ 4.3.2 CPP CPP14 COFFEE DART FORTH JAVA JS-RHINO JULIA KTLN NODEJS OCT PHP PROLOG PYTHON PYPY3 PY_NBC R RACKET SQLITE SWIFT UNLAMBDA