import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.util.NoSuchElementException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; FastScanner in = new FastScanner(inputStream); PrintWriter out = new PrintWriter(outputStream); Task solver = new Task(); solver.solve(1, in, out); out.close(); } static class Task { public void solve(int testNumber, FastScanner in, PrintWriter out) { final int n = in.nextInt(); int[] x = new int[n]; for (int i = 0; i < n; i++) x[i] = in.nextInt(); Arrays.sort(x); int dx = x[1] - x[0]; if (dx == 0) { out.println("NO"); return; } for (int i = 1; i < n; i++) { if (x[i] - x[i - 1] != dx) { out.println("NO"); return; } } out.println("YES"); } } static class FastScanner { private InputStream in; private byte[] buffer; private int p; private int bufLen; public FastScanner(InputStream in) { this.in = in; buffer = new byte[1024]; } private boolean hasNextByte() { if (p < bufLen) return true; p = 0; try { bufLen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } return (bufLen > 0); } private int readByte() { if (hasNextByte()) return buffer[p++]; return -1; } private static boolean isPrintableChar(int c) { return (c >= 33 && c <= 126); } public boolean hasNext() { while (hasNextByte() && !isPrintableChar(buffer[p])) p++; return hasNextByte(); } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || b > '9') throw new NumberFormatException(); while (true) { if (b >= '0' && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } } }