#include<iostream>
using namespace std;
long long arr[100000000];
long long p[100000000];
int main ()
{
    long long N, br=0, k=0;
    cin >> N;
    for (int i=0; i<N; i++)
    {
        cin >> arr[i];
    }
    int i=1;
    while (arr[i]!=0)
    {
        if (arr[i-1]<arr[i] && arr[i]>arr[i+1])
        {
            br++;
            p[k]=i;
            k++;
        }
        i++;
    }
    if (br<2)
    {
        cout << "0" << endl;
    }
    else
    {
        br=p[1]-p[0]-1;
        for (int m=1; m<k-1; m++)
        {
            if ((p[m+1]-p[m]-1)<br)
                br=p[m+1]-p[m]-1;
        }
        cout << br << endl;
    }
    return 0;
}
