n=int(input()) a=sorted(list(map(int,input().split()))) b=set([a[i+1]-a[i] for i in range(n-1)]) if len(s)!=1 or pop(b)==0: print('NO') else: print('YES')