# coding=utf-8: import collections n = int(input()) line = list(map(int, input().split())) line.sort() c = collections.Counter(line) d = c.values() i = 0 k = list() while i != len(line) - 1: k.append(line[i+1] - line[i]) i += 1 if max(d) >= 2: print("NO") elif k.count(k[0]) != len(k): print("NO") else: print("YES")