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