N = int(input()) L = list(map(int,input().split())) L = sorted(L) d = L[1] - L[0] if d == 0 : ans = "NO" else : for i in range(1,N-1) : if d != (L[i+1] - L[i]) : ans = "NO" break else : ans = "YES" print(ans)