#!/usr/bin/env pypy3 # btkさんの解 http://yukicoder.me/submissions/108104 を踏まえて import sys def main(): n = int(input()) # {x_i}を受け取ってソートする xs = sorted(map(int, input().split())) # 階差数列の最大値・最小値を求める d_min = sys.maxsize d_max = -sys.maxsize for i in range(n - 1): d = xs[i + 1] - xs[i] d_min = min(d_min, d) d_max = max(d_max, d) print("YES" if d_min == d_max != 0 else "NO") if __name__ == '__main__': main()