import sys if __name__ == '__main__': n = int(input()) lst = [int(input()) for i in range(n)] lst.sorted() before = lst[0] sa = lst[1] - before for i in range(len(lst)): if i != 0: if lst[i] - before == sa: before = lst[i] continue else: print("NO") sys.exit(0) print("YES")