Baobao loves singing very much and he really enjoys a game called Singing Everywhere, which allows players to sing and scores the players according to their performance.

Consider the song performed by Baobao as an integer sequence , where indicates the -th note in the song. We say a note is a "voice crack" if , and . The more voice cracks BaoBao sings, the lower score he gets.

To get a higher score, BaoBao decides to delete at most one note in the song. What's the minimum number of times BaoBao sings a voice crack after this operation?

Input

There are multiple test cases. The first line of the input contains an integer (about 100), indicating the number of test cases. For each test case:

The first line contains one integer (), indicating the length of the song.

The second line contains integers (), indicating the song performed by BaoBao.

It's guaranteed that at most 5 test cases have .

Output

For each test case output one line containing one integer, indicating the answer.

Sample Input

3
6
1 1 4 5 1 4
7
1 9 1 9 8 1 0
10
2 1 4 7 4 8 3 6 4 7

Sample Output

1
0
2

Hint

For the first sample test case, BaoBao does not need to delete a note. Because if he deletes no note, he will sing 1 voice crack (the 4th note), and no matter which note he deletes, he will also always sing 1 voice crack.

For the second sample test case, BaoBao can delete the 3rd note, and no voice cracks will be performed. Yay!

For the third sample test case, BaoBao can delete the 4th note, so that only 2 voice cracks will be performed (4 8 3 and 3 6 4).

#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int a[200000],flag[200000];
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        memset(flag,0,sizeof(flag));
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
        }
        int maxx=0,sum=0;
        for(int i=2;i<=n-1;i++)
        {
            if(a[i]>a[i-1]&&a[i]>a[i+1])
            {
                flag[i]=1;
                sum++;
            }
        }

        for(int i=2;i<=n-3;i++)
        {
            if(flag[i]==1&&flag[i+2]==1)
            {
                if(a[i]==a[i+2])
                {
                     maxx=2;

                }
                else maxx=1;
                break;
            }
            else if(flag[i]==1)
            {
                if(i==2)
                {
                    if(a[i+1]>a[i-1]&&a[i+1]>a[i+2]) maxx=0;
                }
                else
                {
                    if(a[i+1]>a[i-1]&&a[i+1]>a[i+2]) maxx=0;
                    else if(a[i-1]>a[i-2]&&a[i-1]>a[i+1]) maxx=0;
                    else
                    {
                        maxx=1;
                        break;
                    }
                }
            }
        }
        printf("%d\n",sum-maxx);
    }
}