#include<iostream>
using namespace std;
int a[1001];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
int count=0;
for(int i=1;i<n-1;i++){
if(((a[i]<a[i+1])&&(a[i]<a[i-1]))||((a[i]>a[i+1])&&(a[i]>a[i-1])))
count++;
}
cout<<count<<endl;
}
CCF201603-01
最新推荐文章于 2022-03-11 10:33:08 发布