#include
using namespace std;
bool IsSorted(int A[],int n)
{
if (n==0 || n==1)
{
return true;
}
if (A[0]<A[1] && IsSorted(A+1,n-1))
{
return true;
}
return false;
}
int main()
{
int n;
cin>>n;
int Array[n];
for (int i = 0; i < n; i++)
{
cin>>Array[i];
}
cout<<IsSorted(Array,n);
return 0;
}