n,*c=`dd`.split.map &:to_i c.sort! puts (n-1).times.map{|i|c[i+1]-c[i]}.uniq.size==1?:YES: :NO