package main import ( "bufio" "os" "strings" "strconv" "sort" "fmt" ) func main() { N := largeInt() x := largeIntArray() sort.Ints(x) diff := x[1] - x[0] if diff == 0 { fmt.Println("NO") return } for i := 1; i < N; i++ { if diff != x[i] - x[i - 1] { fmt.Println("NO") return } } fmt.Println("YES") return } var rdr = bufio.NewReaderSize(os.Stdin, 1000000) func readLine() string { buf := make([]byte, 0, 1000000) for { l, p, e := rdr.ReadLine() if e != nil { panic(e) } buf = append(buf, l...) if !p { break } } return string(buf) } func largeInt() (ret int) { s := readLine() ret, e := strconv.Atoi(s) if e != nil { panic(e) } return } func largeIntArray() []int { s := readLine() vs := strings.Split(s, " ") N := len(vs) data := make([]int, N) for i := 0; i < N; i++ { var e error data[i], e = strconv.Atoi(vs[i]) if (e != nil) { panic(e) } } return data }