For this Question: You are given an array a that contains N integers. All the integers in the array may not be distinct. The number of repetitions of each integer in the array is represented by ri. Your task is to print the integers in the decreasing order of their occurrence in the array.

Note 
1. If ri > rj, then ai must be printed before aj.
2. If ri == rj, then among ai and aj whichever has a larger value, is printed first.

Here ri and rj is the number of repetitions of integers ai and aj in the array.The first line of the input contains an integer N.
The second line contains N space- separated integers representing the elements of array a.

<b>Constraints</b>
1<= N <= 1000
1<= ai <= 1000Print the space separated integers in the decreasing order of their occurrence in the array. The output must be printed in a single line.Sample input:
6
1 2 3 3 2 1

Sample Output 
3 2 1, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        Map<Integer,Integer> map = new HashMap<>();
        String []str = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            int e = Integer.parseInt(str[i]);
            map.put(e, map.getOrDefault(e,0)+1);
        }
        List<Map.Entry<Integer,Integer>> list = new ArrayList<>(map.entrySet());

        Collections.sort(list, new Comparator<Map.Entry<Integer,Integer>>(){
            public int compare(Map.Entry<Integer,Integer> o1, Map.Entry<Integer,Integer> o2){
                if(o1.getValue() == o2.getValue()){
                    return o2.getKey() - o1.getKey();
                }
                return o2.getValue() - o1.getValue();
            }
        });

        for(Map.Entry<Integer,Integer> entry: list){
            System.out.print(entry.getKey() + " ");
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?