n=int(input()) x=list(sorted(map(int,input().split()))) d=x[1] - x[0] ok = True for i in range(n-1): if x[i+1] - x[i] != d: ok = False break print("YES" if ok and d>0 else "NO")