#include <cstdio>
#include <memory.h>
using namespace std;
int main(void)
{
freopen("chorus.in","r",stdin);
freopen("chorus.out","w",stdout);
const int NUM=130;
int i=0,j=0,k=0,n=0,temp=0,temp2=0,maxlen=0,a[100]={0},f[101]={0};
scanf("%d\n",&n);
for (i=0;i<n;i++)
scanf("%d ",&a[i]);
for (i=0;i<n;i++)
{
memset(f,0,sizeof(f));
for (j=0;j<=i;j++)
{
temp=0;
for (k=0;k<a[j]-NUM;k++)
if (f[k]>temp)
temp=f[k];
f[k]=temp+1;
}
memset(f,0,sizeof(f));
for (j=n-1;j>=i;j--)
{
temp2=0;
for (k=0;k<a[j]-NUM;k++)
if (f[k]>temp2)
temp2=f[k];
f[k]=temp2+1;
}
temp=temp+temp2+1;
if (temp>maxlen)
maxlen=temp;
}
printf("%d\n",n-maxlen);
fclose(stdin);
fclose(stdout);
return(0);
}