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