input() a=sorted(map(int,input().split())) l={a[i+1]-a[i] for i in range(len(a)-1)} print("NO"if len(l)>1 or 0in l else"YES")