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.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
public class Solution123{
	//static int[] arr;
	static int[] sp;
	//static char[] m;
	//static ArrayList<Integer> arr5;
	static int coun = 0;
	public static void main(String[] args) throws IOException{
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		Set<Integer> s = new HashSet();
		for(int i = 0;i < n;i++){
			s.add(sc.nextInt());
		}
		if(s.size() <= 3){
			if(s.size() == 3){
				int[] arr = new int[3];
				int j = 0;
				for(int i: s){
					arr[j] = i;
					j++;
				}
				Arrays.sort(arr);
				if(Math.abs(arr[1] - arr[0]) == Math.abs(arr[1] - arr[2])){
					System.out.println("YES");
				}else{
					System.out.println("NO");
				}
			}else{
				System.out.println("YES");
			}
		}else{
			System.out.println("NO");
		}
	}
	static long subset(long[] arr){
		int n = arr.length;
		long answer = 0;
		for(int i = 0;i < (1<<n);i++){
			//ArrayList<Integer> a1 = new ArrayList();
			long max = Long.MIN_VALUE;
			long min = Long.MAX_VALUE;
			for(int j = 0;j < n;j++){
				if ((i & (1 << j)) > 0){
					//System.out.print(arr[j] + " ");
					if(arr[j] > max){
						max = arr[j];
					}if(arr[j] < min){
						min = arr[j];
					}
				}
			}
			//System.out.println();
			//System.out.println(min + " " + max);
			if(max != Long.MIN_VALUE && min != Long.MAX_VALUE){
				answer += (max - min);
				answer = (answer + 1000000007) % 1000000007;
			}
			
		}
		return answer;
	}
	static Set<String> substring(String A){
		Set<String> arr = new HashSet();
		for (int i = 0; i < A.length(); i++) {
	        for (int j = i+1; j <= A.length(); j++) {
	            if(isPalindrome(A.substring(i,j))){
	            	arr.add(A.substring(i,j));
	            }
	        }
	    }
		return arr;
	}
	static boolean isPalindrome(String s) {
		  int n = s.length();
		  for (int i = 0; i < (n/2); ++i) {
		     if (s.charAt(i) != s.charAt(n - i - 1)) {
		         return false;
		     }
		  }

		  return true;
	}
	static class Pair implements Comparable<Pair>{
		int indexI;
	    //int indexJ;
		Long value;
		//Integer tempvalue;
		Long profit;
		Pair(){}
		Pair(int indexI,long value){
			this.indexI = indexI;
			//this.indexJ = indexJ;
			this.value = value;
			//this.tempvalue = value;
		}
		public int compareTo(Pair o) {
			return  o.profit.compareTo(profit);
		}
	}
	static String generator(int length){
		StringBuilder st = new StringBuilder("");
		int min = 97;
		int max = 99;
		for(int i = 0;i < length;i++){
			Random rand = new Random();
			st.append((char)(rand.nextInt((max - min) + 1) + min));
		}
		return st.toString();
	}
	static void seive(){
		for(int i = 4;i < sp.length;i += 2){
			sp[i] = 2;
		}
	    for (int i=3; i*i<sp.length; i++)
	    {
	        
	        if (sp[i] == i)
	        {
	            for (int j=i*i; j<sp.length; j+=i)
	                if (sp[j]==j)
	                    sp[j] = i;
	        }
	    }
	}

	public static StringBuilder stringMaker(int n){
		StringBuilder st = new StringBuilder("");
		String s = "aabb";
		int t = n;
		while(t > 3){
			st.append(s);
			t = t - 4;
		}
		s = s.substring(0,t);
		st.append(s);
		return st;
	}
	public static boolean[] sieveAlgo(int n){
		boolean isPrime[] = new boolean[n + 1];
		for (int i = 2; i <= n; i++) {
            isPrime[i] = true;
        }

        // mark non-primes <= n using Sieve of Eratosthenes
        for (int factor = 2; factor*factor <= n; factor++) {

            // if factor is prime, then mark multiples of factor as nonprime
            // suffices to consider mutiples factor, factor+1, ...,  n/factor
            if (isPrime[factor]) {
                for (int j = factor; factor*j <= n; j++) {
                    isPrime[factor*j] = false;
                }
            }
        }
        return isPrime;
	}
	public static int binarySearch(int[] arr,int low,int high,int key){
		while(low <= high){
			int mid = (low + high)/2;
			if(arr[mid] == key){
				return mid;
			}else if(arr[mid] < key){
				low = mid + 1;
			}else{
				high = mid - 1;
			}
		}
		return -1;
	}
	public static int ternarySearch(int[] arr,int l,int r,int key){
		if(r >= l){
			int mid1 = l + (r-1)/3;
			int mid2 = r - (r-1)/3;
			if(arr[mid1] == key){
				return mid1;
			}else if(arr[mid2] == key){
				return mid2;
			}
			if(key < arr[mid1]){
				return ternarySearch(arr,l,mid1-1,key);
			}else if(key > arr[mid2]){
				return ternarySearch(arr,mid2 + 1,r,key);
			}else{
				return ternarySearch(arr,mid1 + 1,mid2 - 1,key);
			}
		}
		return -1;
	}
	public static double fun(double x){
		return 2 * x * x - 12 * x + 7;
	}
	
	public static double tsModified(double start,double end){
		double l = start;
		double r = end;
		for(int i = 0;i < 200;i++){
			double mid1 = (l * 2 + r)/3;
			double mid2 = (l + 2 * r)/3;
			if(fun(mid1) < fun(mid2)){
				r = mid2;
			}else{
				l = mid1;
			}
		}
		double x = l;
		return fun(x);
	}
	public static String fmt(double d)
	{
	    if(d == (long) d)
	        return String.format("%d",(long)d);
	    else
	        return String.format("%s",d);
	}
	public static int[][] comparator(int[][] arr){
		Arrays.sort(arr, new Comparator<int[]>() {
            @Override
            public int compare(int[] a,int[] b) {
                Integer a1 = a[1];
                Integer b1 = b[1];
            	return b1.compareTo(a1);
            }
        });
		return arr;
	}
	public static int[][] comparator2(int[][] arr){
		Arrays.sort(arr, new Comparator<int[]>() {
            @Override
            public int compare(int[] a,int[] b) {
                Integer a1 = a[0];
                Integer b1 = b[0];
            	return b1.compareTo(a1);
            }
        });
		return arr;
	}
	public static Pair[][] comparator2(Pair[][] arr){
		Arrays.sort(arr, new Comparator<Pair[]>() {
           	@Override
			public int compare(Pair[] o1, Pair[] o2) {
				// TODO Auto-generated method stub
				Pair p1 = o1[0];
				Pair p2 = o2[0];
				return p2.compareTo(p1);
			}
        });
		return arr;
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
	public static String min(int m,int n){
		int[] arr = new int[m];
		arr[0] = 1;
		int sum = 1;
		int j = m - 1;
		for(int i = 1;i <= 18* m + 10;i++){
			if(sum != n){
				if(arr[j] == 9){
					j--;
				}else{
					arr[j]++;
					sum++;
				}
			}
			else{
				break;
			}
		}
		StringBuilder min = new StringBuilder("");
		for(int i = 0;i < arr.length;i++){
			min.append(arr[i]);
		}
		return min.toString();
	}
	public static String max(int m,int n){
		int[] arr = new int[m];
		arr[0] = 1;
		int sum = 1;
		int j = 0;
		for(int i = 1;i <= 9 * m + 10;i++){
			if(sum != n){
				if(arr[j] == 9){
					j++;
				}else{
					arr[j]++;
					sum++;
				}
			}
			else{
				break;
			}
		}
		StringBuilder min = new StringBuilder("");
		for(int i = 0;i < arr.length;i++){
			min.append(arr[i]);
		}
		return min.toString();
	}
    public static int KMPSearch(String txt,String pat){
		int m = pat.length();
		int n = txt.length();
		int lps[] = new int[m];
		int j = 0;
		int count = 0;
		PrefixTable(pat,m,lps);
		int i = 0;
		while (i < n)
	        {
	            if (pat.charAt(j) == txt.charAt(i))
	            {
	                j++;
	                i++;
	            }
	            if (j == m)
	            {
	            	count++;
	                j = lps[j-1];
	            }
	            else if (i < n && pat.charAt(j) != txt.charAt(i))
	            {
	                if (j != 0)
	                    j = lps[j-1];
	                else
	                    i = i+1;
	            }
	        }
		return count;
	}
	public static void PrefixTable(String pat,int m,int[] lps){
		int len = 0;
		int i = 1;
		lps[0] = 0;
		while(i < m){
			if(pat.charAt(i) == pat.charAt(len)){
				lps[i] = len + 1;
				i++;
				len++;
			}else if(len > 0){
				len = lps[len - 1];
			}else{
				lps[i] = 0;
				i++;
			}
		}
	}
    public int digit(int x){
    	int temp = x;
    	int count = 0;
    	while(temp != 0){
    		count++;
    		temp = temp/10;
    	}
    	return count;
    }
    public int sum(int x){
    	int temp = x;
    	int count = 0;
    	while(temp != 0){
    		count += temp % 10;
    		temp = temp/10;
    	}
    	return count;
    }
    public int product(int x){
    	int temp = x;
    	int count = 1;
    	while(temp != 0){
    		count*=temp % 10;
    		temp = temp/10;
    	}
    	return count;
    }
    public boolean isValid2(int x){
    	int temp = x;
    	while(temp != 0){
    		if(temp % 10 == 0){
    			return false;
    		}
    		temp = temp/10;
    	}
    	return true;
    }
    public boolean isValid(int x){
    	if(!isValid2(x)){
    		return false;
    	}else{
    		if(product(x) <= sum(x)){
    			return true;
    		}
    		return false;
    	}
    }
}