import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.stream.Stream; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); int N = Integer.parseInt(reader.readLine()); String[] inputs = reader.readLine().split(" "); int[] positions = Stream.of(inputs).mapToInt(Integer::parseInt).toArray(); Arrays.sort(positions); int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; for (int i = 1; i < N; i++) { int differences = positions[i] - positions[i - 1]; max = Math.max(max, differences); min = Math.min(min, differences); } if (max == min && min != 0) { System.out.println("YES"); } else { System.out.println("NO"); } } }