N = int(input()) A = sorted(map(int, input().split())) diff = [b - a for a, b in zip(A[:-1], A[1:])] print("YES" if diff[0] > 0 and len(set(diff)) == 1 else "NO")