#include<iostream>
using namespace std;
int main(){
    long long n, lokmaxCount = 0, prevLokmaxIndex = 0, otgovor;
    cin >> n;
    otgovor = n + 1;
    long long vhod[n];
    for(long long i = 0; i < n; i++){
        cin >> vhod[i];
        if(i > 1 &&  i < n){
            if(vhod[i] < vhod[i - 1] && vhod[i - 2] < vhod[i - 1]){
                lokmaxCount++;
                if(lokmaxCount == 1){
                    prevLokmaxIndex = i - 1;
                }else{
                    if(otgovor > (i - 1) - prevLokmaxIndex - 1){
                        otgovor = (i - 1) - prevLokmaxIndex - 1;
                    }
                    prevLokmaxIndex = i - 1;
                }
            }
        }
    }
    if(lokmaxCount == 0){
        cout << "0";
    }else{
        cout << otgovor;
    }
    return 0;
}
