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>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

int N;
int A[NUM],B[NUM];

int calc(int table[NUM]){

	int ret = 0;
	int x,y,z;

	//★★2番目の不等号を修正するように考える★★

	for(int i = 0; i <= N-3; i++){

		x = table[i];
		y = table[i+1];
		z = table[i+2];

		if(x < y && y < z){

			ret++;

			if(i+3 <= N-1 && y > table[i+3]){

				swap(table[i+2],table[i+3]); //より下りやすくなる

			}else{

				swap(table[i+1],table[i+2]);
			}

		}else if(x > y && y > z){

			ret++;

			if(i+3 <= N-1 && y < table[i+3]){

				swap(table[i+2],table[i+3]); //より上りやすくなる

			}else{

				swap(table[i+1],table[i+2]);
			}
		}
	}

	return ret;
}

int main(){

	scanf("%d",&N);

	for(int i = 0; i < N; i++){

		scanf("%d",&A[i]);
		B[i] = A[i];
	}

	swap(B[0],B[1]);

	int ans_A = calc(A);
	int ans_B = calc(B)+1; //最初のswapの分

	printf("%d\n",min(ans_A,ans_B));

	return 0;
}

