#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define wt(v) {ulong _z=v;do*--wp=_z%10+48;while(_z/=10);} #define rep(v,e) for(long v=0;va[i+1]){ h+=1; } h*=3; m*=3; } rep(i,n-1){ if(rp[i]=='>'){ k+=1; } k*=3; } long z=0; while(h!=k&&za[z+1]){ h-=m; } if(a[z?z-1:n-1]>a[z]){ h+=1; } h*=3; ++z; } char wbuf[64],*wp=wbuf+sizeof wbuf; if(z==n){ *--wp='1'; *--wp='-'; }else{ wt(z); } write(1,wp,wbuf+sizeof wbuf-wp); _exit(0); }