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