problem code: ZCO12001

try:

n=int(input())

l=list(map(int,input().split()))

maxlength=0

l1=[]

length=0

c=0

maxc=0

pos1=0

pos2=0

maxpos1=0

maxpos2=0

for i in range(0,n):

```
if(l[i]==1):
if(len(l1)==0):
l1.append(l[i])
c=1
length=1
pos1=i+1
pos2=i+1
if(length>maxlength):
maxlength=length
maxpos2=pos2
if(c>maxc):
maxc=c
maxpos1=pos1
elif(len(l1)!=0):
l1.append(l[i])
c+=1
pos1+=1
if(c>maxc):
maxc=c
maxpos1=pos1
length+=1
if(length>maxlength):
maxlength=length
maxpos2=pos2
elif(l[i]==2):
c-=1
length+=1
l1.pop()
if maxlength<length:
maxlength=length
maxpos2=pos2
print(maxc,end=" ")
print(maxpos1,end=" ")
print(maxlength,end=" ")
print(maxpos2,end=" ")
```

except:

pass