using System; using System.Collections.Generic; using System.Linq; namespace Test { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); Array.Sort(x); int a = x[1] - x[0]; bool ret = a != 0; for (int i = 1; i < n; i++) { if (x[i] - x[i - 1] != a) ret = false; } Console.WriteLine(ret ? "YES" : "NO"); } } }