using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yuki_406 { class Program { static void Main(string[] args) { Console.ReadLine(); var x = scan(); Array.Sort(x); bool z = false; int k = x[1] - x[0]; if (k==0) { z = true; } for (int i = 2; i < x.Length; i++) { if (x[i]-x[i-1]!=k) { z = true; break; } } if (z) { Console.WriteLine("NO"); } else { Console.WriteLine("YES"); } } static int[] scan() { return Array.ConvertAll (Console.ReadLine().Split(' '), int.Parse); } } }