For this Question: Given an array Arr of N integers. Solve the following problem for X from 1 to N :-
Find the number of ways to select a pair (i, j) such that i < j and i != X and j != X and Arr[i] = Arr[j].First line of input contains a single integer, N.
Second line of input contains N space separated integers, denoting array Arr.

Constraints:
1 <= N <= 100000
1 <= Arr[i] <= NPrint N space separated integers where ith integer is the answer when X = i.Sample Input
5
4 4 1 1 1 

Sample Output
3 3 2 2 2 

Explanation:
For X=1 we have (3, 4) (3, 5) (4, 5)
For X=2 we have (3, 4) (3, 5) (4, 5)
For X=3 we have (1, 2) (4, 5)
For X=4 we have (1, 2) (3, 5)
For X=5 we have (1, 2) (3, 4), I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args)throws IOException {

			BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
			int n=Integer.parseInt(sc.readLine());
			int a[]=new int[n];
			int count[]=new int[n+1];
			String[] temp1=sc.readLine().trim().split(" ");
			for(int i=0;i<n;i++){
				a[i]=Integer.parseInt(temp1[i]);
				count[a[i]]++;
			}
			int val=0,total=0;
			for(int i=0;i<n;i++){
				val=count[i];
				total=total+(val)*(val-1)/2;
			}
             StringBuilder sb=new StringBuilder();


				 for(int j=0;j<n;j++){
					 int result=total-count[a[j]]+1;


					 sb.append(result+" ");
				 }



			System.out.println(sb);




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