why am i getting wrong answer for this code :

https://www.codechef.com/viewsolution/44704509

also if the link not working :

#include <bits/stdc++.h>

using namespace std;

#define lli long long int

int main()

{

ios_base::sync_with_stdio(false);

cin.tie(NULL);

lli testcase;

cin>>testcase;

//enter the remaining constrains

```
lli n;
lli counter1;
while(testcase--)
{
cin>>n;
counter1 = 0;
lli arr[n];
for(lli i=0;i!=n;i++)
cin>>arr[i];
if(n==1)
cout<<"YES\n0\n";
else
{
for(lli i=1;i!=n;i++)
{
if(arr[i-1]==(arr[i]+1))
counter1++;
}
if(counter1==(n-1))
cout<<"YES\n0\n";
else if(counter1==(n-2))
cout<<"YES\n1\n";
else
cout<<"NO\n";
}
}
return 0;
```

}

Please let me know And I will work on it Thank you !!