fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int n1=10000,n2=10000,n3,n,g=0;
  8. scanf("%d",&n);
  9.  
  10. while(n--)
  11. {
  12. scanf("%d",&n3);
  13. if(n1<n2 && n2>n3)g++;
  14. n1=n2;
  15. n2=n3;
  16. }
  17. printf("%d",g);
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5420KB
stdin
10
1 2 3 2 3 4 5 1 2 3
stdout
2