Array sorted Recursion

https://ide.codingblocks.com/s/290075 what is wrong in my code?

#include<bits/stdc++.h>
using namespace std;

int a[1001];
bool isSorted(int n)
{
    if(n==1)
        {
            return true;
        }
        else
        {
            if(a[n]>=a[n-1])
            return  isSorted(n-1);
        }
            return false;
}
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(isSorted(n-1))
	cout <<"true";
	else cout <<"false";
}