#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include using namespace std; int main() { ll n; cin>>n; vector A(n); rep(i,n) cin>>A[i]; if(n==1 || n==2){ cout<<0< B; int x=0,cnt=0; if(A[0]A[1]){ x=-1; cnt=1; } for(int i=2;i<=n;i++){ if(x==1 && A[i-1]A[i]) cnt++; else if(A[i-1]A[i]){ B.push_back(cnt); cnt=1; x=-1; } } B.push_back(cnt); int ma=0; int k=B.size(); if(k<2) cout<<0<