using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] x = Console.ReadLine().Split().Select(v => int.Parse(v)).ToArray(); Array.Sort(x); if (Judge(x)) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } Console.Read(); } static bool Judge(int[] x) { int n = x[1] - x[0]; if (n == 0) { return false; } for (int i = 2; i < x.Length - 1; i++) { if (x[i + 1] - x[i] != n) { return false; } } return true; } }