n=int(input()) p=list(map(int,input().split())) idx=[0]*n for i in range(n): idx[p[i]]=i mod=998244353 ans=1 L,R=idx[0],idx[0] size=0 for i in idx[1:]: if L