import std.stdio, std.string, std.conv, std.algorithm; import std.range, std.array, std.math, std.typecons, std.functional; void main() { int n = readln.chomp.to!int; auto x = readln.split.to!(int[]); x.sort(); auto dif = x[1] - x[0]; if (!dif) { writeln("NO"); return; } bool check = iota(n - 1).all!(i => x[i + 1] - x[i] == dif); writeln(check ? "YES" : "NO"); }