print((function (f, n) local a,t = f() if t==0 then return "NO" end for i=2,n-1 do if t~=a[i+1]-a[i] then return "NO" end end return "YES" end)(function () local a = {} for e in io.stdin:read("*l"):gmatch("%d+") do table.insert(a,tonumber(e)) end table.sort(a) return a,a[2]-a[1] end, tonumber(io.stdin:read("*l"))))