import java.util.*; 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 < N; i++) { x[i] = sc.nextInt(); } Arrays.sort(x); String ans = "YES"; if(x[1] == x[0]) ans = "NO"; for(int i = 2; i < N; i++) { if(x[i] - x[i - 1] != x[1] - x[0]) { ans = "NO"; break; } } System.out.println(ans); } }