N = int(input()) X = list(map(int, input().split())) X.sort() diff = set() for i in range(N - 1): pos, nex = X[i], X[i + 1] diff.add(nex - pos) if 0 in diff: print('NO') else: if len(diff) == 1: print('YES') else: print('NO')