n = int(input()) x = list(map(int, input().split())) x.sort() w = x[1] - x[0] before = x[1] for num in x[2:]: if w != num - before: print("NO") break before = num else: print("YES")