# いいアイディアが思いつかない # 上がっているところは+1、下がっているところは-1、それ以外は0の配列を準備 # セグメントツリーではダメだ、最大か最小のどちらかとなってしまう # それなら2つのセグメントツリーを使うか # もっといい方法があるはずと思うが N = int(input()) A = list(map(int, input().split())) B = [] for i in range(N): if i == 0: B.append(0) else: if A[i] > A[i-1]: B.append(+1) elif A[i] < A[i-1]: B.append(-1) elif A[i] == A[i-1]: B.append(0) # ACL for Python # https://github.com/shakayami/ACL-for-python/blob/master/segtree.py # https://github.com/shakayami/ACL-for-python # https://github.com/shakayami/ACL-for-python/wiki/segtree # セグメントツリー:リストの要約値(たとえばMAX)を記録 class segtree(): n=1 size=1 log=2 d=[0] op=None e=10**15 def __init__(self,V,OP,E): self.n=len(V) self.op=OP self.e=E self.log=(self.n-1).bit_length() self.size=1<>i) def get(self,p): assert 0<=p and p>=1 r>>=1 return self.op(sml,smr) def all_prod(self): return self.d[1] def max_right(self,l,f): assert 0<=l and l<=self.n assert f(self.e) if l==self.n: return self.n l+=self.size sm=self.e while(1): while(l%2==0): l>>=1 if not(f(self.op(sm,self.d[l]))): while(l1 & (r%2)): r>>=1 if not(f(self.op(self.d[r],sm))): while(r= 0: ans1 = 1 ans2 = 0 if ST_max.prod(l+1, r+1) <= 0: ans2 = 1 print(ans1, ans2)