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