import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.NoSuchElementException; class Main { public static void main(String[] args) throws Exception { new Main().run(); } class SegTree{ int n; long[][] v; public SegTree(int n_) { n=1; while(n0) { k=(k-1)/2; v[k]=merge(v[2*k+1], v[2*k+2]); } } long[] query(int a,int b) { return query(0,n,a,b,0); } long[] query(int l,int r,int a,int b,int k) { if(a<=l&&r<=b)return v[k]; else if(r<=a||b<=l)return new long[] {0,0}; else { long[] lv=query(l,(l+r)/2,a,b,2*k+1); long[] rv=query((l+r)/2,r,a,b,2*k+2); return merge(lv,rv); } } long[] merge(long[] a,long[] b) { long[] ret=new long[2]; ret[0]=Math.max(a[0], b[0]); if(ret[0]==a[0])ret[1]+=a[1]; if(ret[0]==b[0])ret[1]+=b[1]; ret[1]%=M; return ret; } } long[] shrink(long[] a) { long[] x=new long[a.length]; long[] ret=new long[a.length]; for(int i=0;i>32)==(x[j+1]>>32)) { ++j; ret[(int)x[j]]=p; } i=j; ++p; } return ret; } final long M=(long)1e9+7; //最長増加列の長さ,最長増加列の個数 void run() { Scanner sc=new Scanner(); int N=sc.nextInt(); long[] A=new long[N]; for(int i=0;i Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} }