N = int(input().strip()) lst = [int(i) for i in input().strip().split()] lst = sorted(lst) if N == 1: print('YES') else: tmp = lst[1] - lst[0] for i in range(len(lst) - 1): if tmp == 0 or tmp != lst[i + 1] - lst[i]: print('NO') break else: print('YES')