import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] x = new int[n]; for (int i = 0; i < x.length; i++) { x[i] = sc.nextInt(); } Arrays.sort(x); for(int i = 0 ; i < n - 1 ; i++) { if(x[i] == x[i + 1]) { System.out.println("NO"); return; } } int sub = x[1] - x[0]; for(int i = 1 ; i < n - 1 ; i++) { if(x[i + 1] - x[i] != sub) { System.out.println("NO"); return; } } System.out.println("YES"); } }