import java.util.Arrays; import java.util.Scanner; public class Kamo { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); boolean tof = true; int[] x = new int[N]; for(int i = 0;i < N;i++){ x[i] = s.nextInt(); } s.close(); Arrays.sort(x); final int d = x[1]-x[0]; for(int i = 1;i < N;i++){ if(x[i] == x[i-1] || x[i]-x[i-1] != d){ tof =false; break; } } if(tof){ System.out.println("YES"); }else{ System.out.println("NO"); } } }