#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const double eps = 1e-6;   const int MAXN = 1e5 + 10;   const int MAXM = 1e6 + 10;   const long long mod = 1e9 + 7;   int a[1010];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     int ans = 0;     for (int i = 1; i < n - 1; i++) {       if (a[i] > a[i - 1] && a[i] > a[i + 1]) ans++;       if (a[i] < a[i - 1] && a[i] < a[i + 1]) ans++;     }     printf( %d n , ans);     return 0;   }   