#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

/* next combination */
int next_combination(int sub) {
    int x = sub & -sub, y = sub + x;
    return (((sub & ~y) / x) >> 1) | y;
}

ll calc_comb2(ll i) {
    if (i == 1) {
        return 0;
    } else {
        return i * (i - 1) / 2;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    map<ll, ll> m;

    REP(i, N) { m[A[i]]++; }
    debug(m);

    ll base_ans = 0;
    for (auto iter = m.begin(); iter != m.end(); iter++) {
        if (iter->second != 1) {
            base_ans += calc_comb2(iter->second);
            debug(iter->second, base_ans);
        }
    }
    debug(base_ans);

    REP(i, N) {
        ll before = calc_comb2(m[A[i]]);
        ll after = calc_comb2(m[A[i]] - 1);

        debug(before, after);
        if (before == 1) {
            cout << base_ans - 1 << endl;
        } else if (before == 0) {
            cout << base_ans << endl;
        } else {
            cout << base_ans - before + after << endl;
        }
    }

    /*
    int k = 2;
    ll counter = 0;
    int bit = (1 << k) - 1;  // bit = {0, 1, 2}
    for (; bit < (1 << N); bit = next_combination(bit)) {
        // bit の表す集合を求める
        vector<int> S;
        for (int i = 0; i < N; ++i) {
            if (bit & (1 << i)) {  // i が bit に入るかどうか
                S.push_back(i);
            }
        }
        if(A[S[0]]==A[S[1]]) counter++;
    }
    */
    return 0;
}


Measured memory_bytes: 11136