N = int(input()) x = list(map(int, input().split())) x.sort() print("YES" if len(set(x)) > 1 and len(set(x[i + 1] - x[i] for i in range(N - 1))) == 1 else "NO")