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;
using ll = long long;
#define int ll
using PII = pair<int, int>;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll INF = (1LL<<60);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  V<int> a(n);
  REP(i, n) cin >> a[i];
  V<int> b(a);
  
  int ret = 0;
  int turn = 0;
  FOR(i, 1, n) {
    // i番目の増減が正しくない
    if(turn == 0) {
      if(a[i-1] < a[i]) {
        // 次が増加ならi-1とi
        // 次が減少ならiとi+1
        if(i+1 >= n || a[i] < a[i+1]) {
          swap(a[i-1], a[i]);
          ret++;
        } else {
          swap(a[i], a[i+1]);
          ret++;
        }
      }
    } else {
      if(a[i-1] > a[i]) {
        // 次が減少ならi-1とi
        // 次が増加ならiとi+1
        if(i+1 >= n || a[i] > a[i+1]) {
          swap(a[i-1], a[i]);
          ret++;
        } else {
          swap(a[i], a[i+1]);
          ret++;
        }
      }
    }
    turn = !turn;
    // cout << i << " " << turn << " " << a << endl;
  }
  // cout << a << endl;

  a = b;
  int ans = ret;
  ret = 0, turn = 1;
    FOR(i, 1, n) {
    // i番目の増減が正しくない
    if(turn == 0) {
      if(a[i-1] < a[i]) {
        // 次が増加ならi-1とi
        // 次が減少ならiとi+1
        if(i+1 >= n || a[i] < a[i+1]) {
          swap(a[i-1], a[i]);
          ret++;
        } else {
          swap(a[i], a[i+1]);
          ret++;
        }
      }
    } else {
      if(a[i-1] > a[i]) {
        // 次が減少ならi-1とi
        // 次が増加ならiとi+1
        if(i+1 >= n || a[i] > a[i+1]) {
          swap(a[i-1], a[i]);
          ret++;
        } else {
          swap(a[i], a[i+1]);
          ret++;
        }
      }
    }
    // cout << i << " " << turn << " " << a << endl;
    turn = !turn;
  }

  chmin(ans, ret);
  cout << ans << endl;

  return 0;
}

