Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.

Filya is given an array of non-negative integers a1, a2, ..., an. First, he pick an integer x and then he adds x to some elements of the array (no more than once), subtract x from some other elements (also, no more than once) and do no change other elements. He wants all elements of the array to be equal.

Now he wonders if it's possible to pick such integer x and change some elements of the array using this x in order to make all elements equal.

Input

The first line of the input contains an integer n (1 ≤ n ≤ 100 000) — the number of integers in the Filya's array. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 109) — elements of the array.

Output

If it's impossible to make all elements of the array equal using the process given in the problem statement, then print "NO" (without quotes) in the only line of the output. Otherwise print "YES" (without quotes).

Examples

Input

5
1 3 3 2 1


Output

YES


Input

5
1 2 3 4 5


Output

NO

Note

In the first sample Filya should select x = 1, then add it to the first and the last elements of the array and subtract from the second and the third elements.
			import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.TreeSet;
				public class Main implements Runnable
				{
					static final long MOD = 1000000007L;
					static final long MOD2 = 1000000009L;
					static class InputReader
					{
						private InputStream stream;
						private byte[] buf = new byte[1024];
						private int curChar;
						private int numChars;
						private SpaceCharFilter filter;
						private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
				 
						public InputReader(InputStream stream)
						{
							this.stream = stream;
						}
						
						public int read()
						{
							if (numChars==-1) 
								throw new InputMismatchException();
							
							if (curChar >= numChars)
							{
								curChar = 0;
								try 
								{
									numChars = stream.read(buf);
								}
								catch (IOException e)
								{
									throw new InputMismatchException();
								}
								
								if(numChars <= 0)				
									return -1;
							}
							return buf[curChar++];
						}
					 
						public String nextLine()
						{
							String str = "";
				            try
				            {
				                str = br.readLine();
				            }
				            catch (IOException e)
				            {
				                e.printStackTrace();
				            }
				            return str;
						}
						public int nextInt()
						{
							int c = read();
							
							while(isSpaceChar(c)) 
								c = read();
							
							int sgn = 1;
							
							if (c == '-') 
							{
								sgn = -1;
								c = read();
							}
							
							int res = 0;
							do 
							{
								if(c<'0'||c>'9') 
									throw new InputMismatchException();
								res *= 10;
								res += c - '0';
								c = read();
							}
							while (!isSpaceChar(c)); 
							
							return res * sgn;
						}
						
						public long nextLong() 
						{
							int c = read();
							while (isSpaceChar(c))
								c = read();
							int sgn = 1;
							if (c == '-') 
							{
								sgn = -1;
								c = read();
							}
							long res = 0;
							
							do 
							{
								if (c < '0' || c > '9')
									throw new InputMismatchException();
								res *= 10;
								res += c - '0';
								c = read();
							}
							while (!isSpaceChar(c));
								return res * sgn;
						}
						
						public double nextDouble() 
						{
							int c = read();
							while (isSpaceChar(c))
								c = read();
							int sgn = 1;
							if (c == '-') 
							{
								sgn = -1;
								c = read();
							}
							double res = 0;
							while (!isSpaceChar(c) && c != '.') 
							{
								if (c == 'e' || c == 'E')
									return res * Math.pow(10, nextInt());
								if (c < '0' || c > '9')
									throw new InputMismatchException();
								res *= 10;
								res += c - '0';
								c = read();
							}
							if (c == '.') 
							{
								c = read();
								double m = 1;
								while (!isSpaceChar(c)) 
								{
									if (c == 'e' || c == 'E')
										return res * Math.pow(10, nextInt());
									if (c < '0' || c > '9')
										throw new InputMismatchException();
									m /= 10;
									res += (c - '0') * m;
									c = read();
								}
							}
							return res * sgn;
						}
						
						public String readString() 
						{
							int c = read();
							while (isSpaceChar(c))
								c = read();
							StringBuilder res = new StringBuilder();
							do 
							{
								res.appendCodePoint(c);
								c = read();
							} 
							while (!isSpaceChar(c));
							
							return res.toString();
						}
					 
						public boolean isSpaceChar(int c) 
						{
							if (filter != null)
								return filter.isSpaceChar(c);
							return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
						}
					 
						public String next() 
						{
							return readString();
						}
						
						public interface SpaceCharFilter 
						{
							public boolean isSpaceChar(int ch);
						}
					}
				 	
					public static void main(String args[]) throws Exception
					{
						new Thread(null, new Main(),"Main",1<<26).start();
					}
					int MAXN = 1000001;
					ArrayList<Integer> adj[];
					int V;
					public void run() 
					{
						InputReader sc= new InputReader(System.in);
						PrintWriter w= new PrintWriter(System.out);
						int n = sc.nextInt();
						int[] arr = new int[n];
						int diff = -1;
						int diff2 = -1;
						for(int i = 0;i < n;i++) {
							arr[i] = sc.nextInt();
							if(diff == -1) {
								diff = arr[i];
							}else {
								if(diff2 == -1) {
									if(arr[i] != diff) {
										diff2 = arr[i];
									}
								}
							}
						}
						if(diff2 == -1) {
							w.println("YES");
							w.close();
							System.exit(0);
						}
						int ans = (Math.abs(diff2 + diff) % 2 == 0) ? Math.abs(diff2 + diff)/2 : Integer.MAX_VALUE;
						boolean fans = function(diff, arr) | function(diff2,arr) | function(ans,arr);
						if(fans) {
							w.println("YES");
						}else {
							w.println("NO");
						}
						w.close();
					}
					boolean function(int val,int[] arr) {
						TreeSet<Integer> tset = new TreeSet();
						for(int i = 0;i < arr.length;i++) {
							if(arr[i] != val) {
								int dif = arr[i] - val;
								if(dif < 0) {
									tset.add(-(dif));
								}else {
									tset.add(dif);
								}
							}
						}
						if(tset.size() == 1) {
							return true;
						}else {
							return false;
						}
					}
					int[] segTree;
					int[] arr;
					void update(int l,int r,int ind,int pos) {
						if(ind < l || r < ind) {
							return;
						}
						if(l == r) {
							arr[ind] += 1;
							segTree[pos] += 1;
							return;
						}
						int mid = (l + r)/2;
						update(l, mid,ind, 2*pos+1);
						update(mid+1, r,ind,2*pos+2);
						segTree[pos] = segTree[2*pos+1] + segTree[2*pos+2];
					}
					int query(int pos, int l, int r, int start, int end)
					{
					    if(end < l || r < start)
					    {
					        return 0;
					    }
					    if(start <= l && r <= end)
					    {
					        // range represented by a node is completely inside the given range
					        return segTree[pos];
					    }
					    // range represented by a node is partially inside and partially outside the given range
					    int mid = (l + r) / 2;
					    int p1 = query(2*pos + 1, l, mid, start, end);
					    int p2 = query(2*pos+2, mid+1, r, start, end);
					    return p1 + p2;
					}
					
					static class Temp implements Comparable<Temp>{
						int a;
						int b;
						Temp(int a,int b){
							this.a = a;
							this.b = b;
						}
						@Override
						public int compareTo(Temp t){
							if(this.a == t.a) {
								return Integer.compare(this.b,t.b);
							}
							return Integer.compare(this.a,t.a);
						}
					}
					static class Pair implements Comparable<Pair>{
						int first;
						int max;
						int second;
						int val1;
						int val2;
						boolean whole;
						
						Pair (int a,int b,int c,int val1,int val2,boolean whole){
							this.first = a;
							this.max = b;
							this.second = c;
							this.val1= val1;
							this.val2 = val2;
							this.whole = whole;
						}
						Pair(){
							
						}
						public boolean equals(Object o)
						{
							Pair p = (Pair)o;
							return (p.first==first && p.max==max) || (p.first == max && p.first == max);
						}
						public int hashCode()
						{
							return new Long(first).hashCode()*31 + new Long(max).hashCode();
						}
						public int compareTo(Pair p){
							return Long.compare(p.first,this.first);
						}
					}
				
				}