func_code_string: #include <bits/stdc++.h>   int main(void) {     int n;     int a[1100];     while (scanf( %d , &n) == 1) {       for (int i = 0; i < n; i++) scanf( %d , a + i);       int cnt = 1, ans = 0;       int j = 0;       if (n <= 2) {         printf( %d n , ans);         break;       }       if (a[0] > a[1])         j = -1;       else if (a[0] == a[1])         j = 0;       else         j = 1;       while (cnt < n - 1) {         if (j == -1) {           for (; cnt < n - 1 && a[cnt] > a[cnt + 1]; cnt++)             ;           if (cnt == n - 1) break;           if (a[cnt] > a[cnt + 1])             j = -1;           else if (a[cnt] == a[cnt + 1])             j = 0;           else {             ans++;             j = 1;           }         }         if (j == 0) {           for (; cnt < n - 1 && a[cnt] == a[cnt + 1]; cnt++)             ;           if (cnt == n - 1) break;           if (a[cnt] > a[cnt + 1])             j = -1;           else if (a[cnt] == a[cnt + 1])             j = 0;           else             j = 1;         }         if (j == 1) {           for (; cnt < n - 1 && a[cnt] < a[cnt + 1]; cnt++)             ;           if (cnt == n - 1) break;           if (a[cnt] > a[cnt + 1]) {             ans++;             j = -1;           } else if (a[cnt] == a[cnt + 1])             j = 0;           else             j = 1;         }       }       printf( %d n , ans);     }     return 0;   }   