简单dp
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
using namespace std;
#define N 200010
int p[N],dp[N][];
int main()
{
int i,a,b;
scanf("%d%d",&a,&b);
for(i = ; i <= b-a+ ; i++)
scanf("%d",&p[i]);
dp[][] = ;
dp[][] = ;
for(i = ; i <= b-a+ ; i++)
{
if(p[i]>p[i-])
{
dp[i][] = min(dp[i-][]+,dp[i-][]);
dp[i][] = min(dp[i-][]+,dp[i-][]+);
}
else if(p[i]<p[i-])
{
dp[i][] = min(dp[i-][]+,dp[i-][]+);
dp[i][] = min(dp[i-][]+,dp[i-][]);
}
else
{
dp[i][] = min(dp[i-][],dp[i-][]+);
dp[i][] = min(dp[i-][],dp[i-][]+);
}
}
int ans = min(dp[b-a+][],dp[b-a+][]);
printf("%d\n",ans);
return ;
}