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]
  val table = Array.ofDim[Int](n-1)
  for(i <- 0 until n - 1) {
    table(i) = (seq(i+1) - seq(i))
    set += table(i)
  }

  // println(table.mkString(" "))

  var a = 0
  var b = 0
  for(i <- 1 until table.size) {
    if(table(i) + table(i-1) != 0) a += 1
    if(table(i-1) - table(i) != 0) b += 1
  }
  // println(a min b)
  val ans = if(set.size == 1) n / 2 else (a min b)
  println(ans)
}