Increasingdecreasingsequence.cpp

this code is not working for every input acc to question in chalanges and fundamentals plzz tell what i am not considering in this problem

please share your code

#include
using namespace std;
int main()
{ int i,j,n,count,count1,mount1,mount,l,temp,i1;
cin>>n;
count=0;
mount=0;
count1=0;
mount1=0;
temp=0;

int arr[n];
for(i=0;i<n;i++)
 {
  cin>>arr[i];
 }

 for(i=1;i<n;i++)
 {
if(arr[0]<arr[i])
count++;
else
count1++;
 }

for(j=1;j<n;j++)
{
if(arr[0]>arr[j])
mount++;
else
mount1++;
}
//till here i checked if the array is completely increasing or completely decreasing

         if((count==n-1&&count1==0)||(mount==n-1&&mount1==0))
         cout<<"true";

//from here i use some help but the same error occur again and also become a bit messy can u plz suggest the main hints to solve the above problem
else
{
for(;i1<n;i1++)
{
if(arr[i1]<arr[i1+1])
{
temp =i1;
break;
}
}

for(l=0;l<temp;l++)
{
if(arr[l]<arr[l+1])
{
cout << “false”;
break;
}
}
int z = temp +1;
for(;z<n;z++)
{
if(arr[z]>arr[z+1])
{
cout << “false”;
break;
}
}
if(z==n && j==temp)
cout << “true”;
}

return 0;

}

save your code on the online ide. it will help me in faster debugging