N = int(input()) x = list(map(int, input().split())) x = sorted(x) if len(set(x)) != N: print('NO') else: a = x.pop(0) b = x.pop(0) d = b - a for c in x: if c - b != d: print('NO') break b = c else: print('YES')