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