n = int(input()) x = list(map(int, input().split())) x.sort() diff = x[0] - x[1] ans = "YES" for e1, e2 in zip(x, x[1:]): if e1 == e2 or e1 - e2 != diff: ans = "NO" break print(ans)