n = int(input())

ds = sorted([int(x) for x in input().split()])

d = ds[1] - ds[0]

if d > 0 and all(ds[i+1] - ds[i] == d for i in range(n-1)):
    print('YES')
else:
    print('NO')