import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.stream.Stream; public class No00000406_Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); int[] arr = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); Arrays.sort(arr); int dist = arr[1] - arr[0]; for(int i = 0; i < n - 1; i++) { if(arr[i] == arr[i + 1] || dist != arr[i + 1] - arr[i]) { System.out.println("NO"); return; } } System.out.println("YES"); } }