n = int(input()) x = list(map(int, input().split())) # Check for duplicates if len(set(x)) != n: print("NO") else: x_sorted = sorted(x) min_val = x_sorted[0] max_val = x_sorted[-1] total_diff = max_val - min_val # Check if total difference can be evenly divided by (n-1) if total_diff % (n - 1) != 0: print("NO") else: d = total_diff // (n - 1) # Check each consecutive pair valid = True for i in range(1, n): if x_sorted[i] - x_sorted[i-1] != d: valid = False break print("YES" if valid else "NO")