Scanner error. Not taking input

not accepting input by scanner.

public static void main(String args[]) {
// Your Code Here
Scanner sc = new Scanner(System.in);
int N;
N=sc.nextInt();

	int l[] =new int[N];
	for(int i=0;i<N; i++)
	{
		l[i]=sc.nextInt();
	}

	System.out.println(IsSorted(l,N));

}

error:
Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at sort.main(sort.java:29)

There’s a problem with the way you are giving input. Probably you are providing insufficient input or mismatched data types’ input

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

import java.util.*;
public class Main {

public static boolean sort(int[] a,int n)
{
	if(n==a.length-1)
		return true;
	
	boolean rec=sort(a,n+1);
	if(rec==true)
	{
		if(a[n+1]>a[n])
			return true;
		else 
			return false;
	}
	else
		return false;
}

public static void main(String args[]) {

Scanner sc=new Scanner(System.in);

int N=sc.nextInt();

int list[]=new int[N];
for(int i=0;i<N;i++)
{
	list[i]=sc.nextInt();
}

System.out.println(sort(list,0));

}
}

this is the full code. and data types are also correct. Still getting wrong output

Instead of checking for strictly increasing, check for equality conditions as well. Like , for the input 1 2 2 3 5 your input will output false while it should output true.