_ = input() positions = sorted(list(map(int, input().split()))) d = positions[0] - positions[1] for i, position in enumerate(positions[:-1]): D = positions[i] - positions[i+1] if D != d or D == 0: print("NO") break else: print("YES")