For this Question: There are N monsters, the i<sup>th</sup> of them having strength P<sub>i</sub>. A monster i can eat monster j if and only if all of the following conditions are true:
<ul>
<li>Strength of monster i is strictly more than monster j. More formally, P<sub>i</sub> > P<sub>j</sub>. </li>
<li>Monster j has not already been eaten. </li>
<li>Monster i has not already eaten some other monster. </li>
</ul>
More formally, each monster can eat at most one other monster. Furthermore, each monster can be eaten by at most one monster.
All the N monsters are pushed together into an arena. Find the minimum number of remaining live monsters possible after an infinite amount of time.The first line of the input contains a single integer N.
The second line of the input contains N space seperated integers.

<b>Constraints:</b>
1 <b>&le;</b> N <b>&le;</b> 10<sup>5</sup>
1 <b>&le;</b> P<sub>i</sub> <b>&le;</b> 10<sup>5</sup>Print the maximum number of remaining live monsters possible after an infinite amount of time.Sample Input:
4
3 1 2 4

Sample Output:
1

Explaination:
Monster 3 will eat monster 2.
Monster 1 will eat monster 3.
Monster 4 will eat monster 1.
Only monster 4 will remain alive at the end., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        for(int i=0 ;i<n; i++){
            arr[i]=sc.nextInt();
        }
        Arrays.sort(arr);
        int j=0;
        for(int i=1; i<n; i++){
            if(arr[i]>arr[j]){
                arr[j]=0;
                j++;
            }
        }
        int count=0;
        for(int i=0; i<n; i++){
            if(arr[i]!=0){
                count++;
            }
        }
        System.out.print(count);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?