import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;


public class Main{
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
	
	static class Pair
	{
		int p;
		int q;
		Pair(int p,int q)
		{
			this.p = p;
			this.q = q;
		}
	}
	
	static int gcd(int a,int b)
	{
		if(a == 0) return b;
		if(b == 0) return a;
		
		return gcd(b,a%b);
	}
	static long gcd(long a,long b)
	{
		if(a == 0) return b;
		if(b == 0) return a;
		
		return gcd(b,a%b);
	}
	static void preCompute(long fact[])
	{
		fact[0] = 1;
		for(int i = 1; i < fact.length; i++)
		{
			fact[i] = i*fact[i-1]%rem;
		}
	}
	static long power(long x, long y, long p) 
    { 
        long res = 1; 
        x = x % p; 
                      
        while (y > 0) 
        {
            if (y % 2 == 1) 
                res = (res * x) % p; 
 
            y = y >> 1; 
            x = (x * x) % p; 
        }
        return res; 
    } 
	static long modInverse(long n, long p) 
    { 
        return power(n, p-2, p); 
    }
	
	static long nCrModPFermat(int n, int r, long p) 
	{ 

		if (r == 0) 
			return 1; 

		return (fact[n]* modInverse(fact[r], p) % p * modInverse(fact[n-r], p) % p) % p; 
	}
	static long rem = (long)(1e9)+7;
	static long fact[];
	static int n,k;
	
	public static boolean checkPalindrome(String s)
	{	
		//System.out.println(s);
		int j = s.length()-1;
		boolean pos = true;
		for(int i = 0; i < s.length(); i++)
		{
			if(s.charAt(i) != s.charAt(j)) 
			{
				pos = false;
				break;
			}
			j--;
		}
		
		return pos;
	}
	
	public static long nc2(long n)
	{
		long ans = 0L;
		ans = n*(n-1);
		ans /= 2;
		
		//System.out.println(n+" "+ans);
		return ans;
	}
	public static void main(String[] args) 
	{
		OutputStream outputStream = System.out;
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        
        int n = sc.nextInt();
        int a[] = new int[n];
        
        int map[] = new int[n+1];
        
        for(int i = 0; i < n; i++)
        {
        	a[i] = sc.nextInt();
        	map[a[i]]++;
        }
        
        long sum = 0L;
        for(int i = 1; i <= n; i++)
        {
        	sum += nc2((long)map[i]);
        }
        //System.out.println(sum);
        long ans = 0L;
        for(int i = 0; i < n; i++)
        {
        	int cnt = map[a[i]];
        	ans = nc2((long)(cnt-1)) - nc2((long)(cnt)) + sum;
        	out.println(ans);
        }
        out.close();
	}

}


Measured memory_bytes: 50560