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