import scala.io.{StdIn => in}
import scala.collection.{mutable => mu}

object Main extends App {
  val n = in.readInt
  val seq = in.readLine.split(" ").map(_.toInt)

  val set = mu.HashSet.empty[Int]
  for(i <- 0 until n - 1) {
    set += (seq(i+1) - seq(i))
  }
  val ans = if(set.size == 1) n / 2 else set.size - 1
  println(ans)
}