#D5458. Bumpy Array

    ID: 4536 Type: Default 2000ms 268MiB

Bumpy Array

Bumpy Array

problem

Given the sequence A A of length N N . The i i item in A A is Ai 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 Ai A_i with the value of Ai+1 A_ {i + 1} .

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

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

  • For any i i that satisfies 1<i<N 1 <i <N , ​​Ai+1,Ai1>Ai A_ {i + 1}, A_ {i --1}> A_i or Ai+1,Ai1<AiSatisfy 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

inputFormat

outputFormat

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

样例

5
1 2 3 4 5
2