problem

Given the sequence $ A $ of length $ N $. The $ i $ item in $ A $ is $ A_i $. You can do the following for this sequence:

* $ 1 \ leq i \ leq N --Choose the integer i that is 1 $. Swap the value of $ A_i $ with the value of $ A_ {i + 1} $.



Find the minimum number of operations required to make $ A $ a sequence of bumps.

A sequence of length $ N $ that satisfies the following conditions is defined as a sequence of irregularities.

* For any $ i $ that satisfies $ 1 <i <N $, ​​$ A_ {i + 1}, A_ {i --1}> A_i $ or $ A_ {i + 1}, A_ {i --1} <A_i Satisfy $.
Intuitively, increase, decrease, increase ... (decrease, like $ 1, \ 10, \ 2, \ 30, \ \ dots (10, \ 1, \ 30, \ 2, \ \ dots) $ It is a sequence that repeats increase, decrease ...).



output

Output the minimum number of operations required to make a sequence of bumps. Also, output a line break at the end.

Example

Input

5
1 2 3 4 5


Output

2
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)

int n;
int a[125252];

int main(){
  scanf("%d",&n);
  int ans = 0;
  REP(i,n)scanf("%d",a+i);
  REP(i,n-2){
    int x = a[i];
    int y = a[i+1];
    int z = a[i+2];
    if((x<y&&y>z) || (x>y&&y<z))continue;
    if(i+2==n-1){
      swap(a[i+1], a[i+2]);
      ans++;
      continue;
    }
    int w = a[i+3];
    if(x>y && y>z){
      x *= -1;
      y *= -1;
      z *= -1;
      w *= -1;
    }
    // x < y < z ? w
    // x < y < z < w -> x < y > z < w
    // x < y < z > w -> x < y > w < z   or   x < z > y < w
    if(z<w){
      swap(a[i+1], a[i+2]);
      ans++;
    }else if(w<y){
      swap(a[i+2], a[i+3]);
      ans++;
    }else if(w>y){
      swap(a[i+1], a[i+2]);
      ans++;
    }
  }
  printf("%d\n",ans);
  return 0;
}

