#include #include #include #include #include #include #include #include #include #include #define mkp make_pair #define mkt make_tuple #define rep(i,n) for(int i = 0; i < (n); ++i) #define all(v) v.begin(),v.end() using namespace std; typedef long long ll; const ll MOD=1e9+7; template void chmin(T &a,const T &b){if(a>b) a=b;} template void chmax(T &a,const T &b){if(a>N; vector A(N); rep(i,N) cin>>A[i]; vector B=A; sort(all(B)); if(A==B){ cout<<0< dp(N+1,0); dp[0]=0; for(int i=0;i+1A[i+1]) dp[i+1]++; } for(int i=N-1;i>=1;i--){ if(dp[i]==1&&A[0]>=A[i]){ cout<<1<