N = int(input()) x = list(map(int, input().split())) x = sorted(x) if len(x) != len(set(x)): print('NO') else: a = x.pop(0) b = x.pop(0) d = b - a for c in x: if b - c != d: print('NO') break b = c else: print('YES')