class Problem0406: def solve(this): n = int(input()) c1 = True res = {} for i in map(int, input().split()): res[i] = res.get(i, 0) + 1 if res[i] >= 2: c1 = False t = sorted(list(res.keys())) c2 = {} for i in range(len(t) - 1): k = abs(t[i+1] - t[i]) c2[k] = c2.get(k, 0) + 1 if c1 and len(c2) == 1: print("YES") else: print("NO") if __name__ == "__main__": problem = Problem0406() problem.solve()