import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) X = np.array(read().split(),np.int64) X.sort() dx = np.diff(X) w = dx[0] answer = 'YES' if (dx == w).all() else 'NO' print(answer)