For this Question: There are n people in a circle, numbered from 1 to n, each of whom always tells the truth or always lies.
Each person i makes a claim of the form: “the number of truth-tellers in this circle is between a<sub>i</sub> and b<sub>i</sub>, inclusive.”
Compute the maximum number of people who could be telling the truth.The first line contains a single integer n (1 ≤ n ≤ 10^3). 
Each of the next n lines contains two space-separated integers a<sub>i</sub> and b<sub>i</sub>
(0 ≤ a<sub>i</sub> ≤ b<sub>i</sub> ≤ n).Print, on a single line, the maximum number of people who could be telling the truth. If the given
set of statements are inconsistent, print -1 instead.Sample input
3
1 1
2 3
2 2

Sample output 
2

Sample input
8
0 1
1 7
4 8
3 7
1 2
4 5
3 7
1 8

Sample output
-1, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException{
                BufferedReader read=new BufferedReader(new InputStreamReader(System.in));
				int n=Integer.parseInt(read.readLine());
				int count=0;

				int cnt[]=new int[n+2];
				for(int i=0;i<n;i++){
				StringTokenizer st=new StringTokenizer(read.readLine()," ");
				int ai=Integer.parseInt(st.nextToken());
				int bi=Integer.parseInt(st.nextToken());
                 for(int j=ai;j<=bi;j++)
				 {
					 cnt[j]++;
				 }
				}
				int ans=-1;
				for(int i=0;i<=n;i++){

					 if(cnt[i]==i)
					{
						ans=i;
					}
				}

                System.out.println(ans);



	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?