using System;
using System.Collections.Generic;
namespace rummy
{
class Program
{
///
/// プログラムのエントリポイント
///
///
static void Main(string[] args)
{
Console.ReadLine();
string[] tmp = Console.ReadLine().Split(' ');
List list = new List();
foreach (string s in tmp)
list.Add(int.Parse(s));
list.Sort();
Console.WriteLine(JudgeInterval(list));
}
private static string JudgeInterval(List list)
{
for (int i = 0; i < list.Count - 1; i++)
if (list[i] == list[i + 1])
return "NO";
int interval = list[0] - list[1];
for (int i = 1; i < list.Count - 1; i++)
if (list[i] - list[i + 1] != interval)
return "NO";
return "YES";
}
}
}