n = int(input()) s = list(map(int, input().split())) s = list(set(s)) s.sort() if len(s) == 1: print('NO') else: d = [] for i in range(len(s)-1): diff = s[i+1] - s[i] d.append(diff) d = set(d) if len(d) == 1: print('YES') else: print('NO')