#coding:utf-8 input() kamos=list(map(int,input().split())) kamos.sort() dst=kamos[0]-kamos[1] for i in range(1,len(kamos)): if (kamos[i] - kamos[i-1] != dst) or (kamos[i] - kamos[i-1]==0): print("NO") exit() print("YES")