N = int(input()) xlist = input().split() xlist = [int(i) for i in xlist] xlist.sort() distlist = [0 for i in range(N)] for i in range(0, N-1): distlist[i] = xlist[i+1] - xlist[i] temp = distlist[0] flag = 1 for i in range(0, N-1): if distlist[i] == 0: flag = 0 elif distlist[i] == temp: pass else: flag = 0 if flag == 1: print("YES") elif flag == 0: print("No") else: print("ERROR")