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 int long long
const int INF = 1e9;

signed main() {
  int N;
  cin >> N;

  vector<int> A(N);
  for ( int i = 0; i < N; i++ ) {
    cin >> A[i];    
  }

  vector<int> a = A;
  int ans = INF;
  int cnt = 0;
  bool now = 0;
  for ( int i = 0; i < N-1; i++ ) {    
    if ( now ) { // 増加
      if ( a[i] > a[i+1] ) {
	if ( i < N-2 && a[i] < a[i+2] ) {
	  swap(a[i+1], a[i+2]);	  
	} else {
	  swap(a[i], a[i+1]);	 
	}
	cnt++;	
      }
    } else { // 減少
      if ( a[i] < a[i+1] ) {
	if ( i < N-2 && a[i] > a[i+2] ) {
	  swap(a[i+1], a[i+2]);	  
	} else {
	  swap(a[i], a[i+1]);	 
	}
	cnt++;	
      }
    }
    now = !now;    
  }
  
  ans = cnt;

  a = A;
  cnt = 0;
  now = 1;
  for ( int i = 0; i < N-1; i++ ) {
    if ( now ) { // 増加
      if ( a[i] > a[i+1] ) {
	if ( i < N-2 && a[i] < a[i+2] ) {
	  swap(a[i+1], a[i+2]);	  
	} else {
	  swap(a[i], a[i+1]);	 
	}
	cnt++;	
      }
    } else { // 減少
      if ( a[i] < a[i+1] ) {
	if ( i < N-2 && a[i] > a[i+2] ) {
	  swap(a[i+1], a[i+2]);	  
	} else {
	  swap(a[i], a[i+1]);	 
	}
	cnt++;	
      }
    }
    now = !now;    
  }

  cout << min(ans, cnt) << endl;
  
  return 0;
}

