a=int(input()) b=[int(i) for i in input().split()] b.sort() for i in range(1,a): if i==1: c=b[i]-b[i-1] elif b.count(b[0])>=1: print("NO") break elif i>=2: d=b[i]-b[i-1] if c!=d: print("NO") break else: print("YES")