n = int(input()) x = [int(x) for x in input().split()] x.sort() sp = x[1] - x[0] res = True for i in range(len(x) - 1): d = x[i + 1] - x[i] if d == 0 or d != sp: res = False break if res: print('YES') else: print('NO')