package main import . "fmt" import . "sort" func main() { var n int Scan(&n) a:=make([]int,n) for i:=range a { Scan(&a[i]) } Ints(a) x:=a[0]!=a[n-1] for i,v:=range a[1:] { x=x&&(a[1]-a[0]==v-a[i]) } if x { Println("YES") } else { Println("NO") } }