import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class No406 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int count = s.nextInt(); Integer[] arr = new Integer[count]; String out = "YES"; for (int i = 0; i < count; i++) { arr[i] = s.nextInt(); } Arrays.sort(arr, Comparator.reverseOrder()); int diff = arr[1] - arr[0]; if (diff == 0) { out = "NO"; } else { for (int i = 1; i < count; i++) { if (arr[i] - arr[i - 1] != diff) { out = "NO"; break; } } } System.out.println(out); } }