def d(): if len(set(x))!=n:return "NO" s=set() a=x.pop() while x: b=x.pop() s.add(a-b) a=b return ("NO","YES")[len(s)==1] n=int(input()) x=sorted([i for i in map(int,input().split())]) print(d())