n = int(input()) x = sorted([int(i) for i in input().split()]) x_s = set([i - j for i, j in zip(x[1:], x[:-1])]) print("YES" if len(set(x)) == n and len(x_s) == 1 else "NO")