a,b,s;main(c){for(scanf("%*d%d%d",&a,&b);~scanf("%d",&c);a=b,b=c)a-b&&b-c&&ab&&s++;a=!printf("%d",s);}