import sys if __name__ == '__main__': n = int(input()) lst = list(map(int, input().split())) lst.sort() 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")