For the new infectious disease, COVID-99, numbers of new positive cases of PCR tests conducted in the city are reported daily. You are requested by the municipal public relations department to write a program that counts the number of the peaks so far of the positive cases.
Here, the number of peaks is the number of days on which the number of positive cases reported is more than both of the day before and the next day.
As the PCR tests started before the disease started spreading in the city, the number of positive cases is zero on the first day. The last reported day is not counted as a peak. No two consecutive days have the same number of positive cases.
The input consists of multiple datasets. Each dataset is in the following format.
n
v1 ... vn
n is the number of days on which the numbers of positive cases are reported (3 ≤ n ≤ 1000). vi is the number of positive cases on the i-th day, an integer between zero and 1000, inclusive. Note that v1 is zero, and vi ≠ vi+1 for 1 ≤ i < n, as stated above.
The end of the input is indicated by a line containing a zero. The input consists of at most 100 datasets.
For each dataset, output the number of peaks in a line.
3 0 1000 0 5 0 1 2 0 1 3 0 1 2 7 0 1 0 1 8 7 6 11 0 4 3 7 6 10 7 8 4 6 10 0
1 1 0 2 4