using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int kamoCount = int.Parse(Reader.ReadLine()); int[] kamoList = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); Dictionary dic = new Dictionary(); string ans = "YES"; for (int i = 0; i < kamoList.Length; i++) { if (dic.ContainsKey(kamoList[i])) { ans = "NO"; break; } dic.Add(kamoList[i], true); } if (ans.Equals("YES")) { List keys = dic.Keys.OrderBy(a=>a).ToList(); int prev = -1; for (int i = 1; i < keys.Count; i++) { if (prev > 0) { if (prev != keys[i] - keys[i - 1]) { ans = "NO"; break; } } else { prev = keys[i] - keys[i - 1]; } } } Console.WriteLine(ans); } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }