//#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
template <typename T>
using os = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef double ld;
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pii >
#define mi map<ll,ll>
#define umi unordered_map<ll,ll,custom_hash>
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define make make_pair
#define ff first
#define ss second
#define osl os<ll>
#define ospii os<pair<ll,ll> >
#define n_l '\n'
#define mem(a,b) memset(a,b,sizeof(a))
#define el "\n"
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)), __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
clock_t time_p=clock();
std::istream& in(std::cin);
std::ostream& ot(std::cout);
ll mod=1e9+7;
void Auriel()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
struct custom_hash {
    static uint64_t splittpix64(uint64_t x) {

        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splittpix64(x + FIXED_RANDOM);
    }
};
template <typename R>
void println(R r){
    for(auto i:r)
        cout<<i<<" ";
    cout<<endl;

}
template <typename R>
void print(R r){
    int e=0;
    for(auto i:r)
        cout<<i<<endl;
}
template <typename R>
void scnln(R &r){
    for(auto &i:r)
        cin>>i;
}
ll depth[400005],parent[400005];
void make_set(int v) {
    parent[v] = v;
    depth[v] = 0;
}
int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (depth[a] < depth[b])
            swap(a, b);
        parent[b] = a;
        if (depth[a] == depth[b])
            depth[a]++;
    }
}
int bfs(vi graph[],vi &visit,ll start,ll &one,ll &two) {
    queue<ll> q;
    q.push(start);
    //visit[start]=1;

    one++;
    while (q.size() != 0) {
        ll p = q.front();
        q.pop();
        if (visit[p] == 1) continue;
        visit[p] = 1;
        for (auto child:graph[p]) {
            if (!visit[child]) {
                //visit[child]=1;
                q.push(child);

            }

        }
        return 0;
    }
}

constexpr ll md = 583725813046261937; // 998244353;
void dfs(vi graph[],ll *visit,ll start,vi &color) {
    visit[start] = 1;

    int w = 0, b = 0;
    for (auto child:graph[start]) {
        if (!visit[child]) {
            dfs(graph, visit, child, color);
        }
    }
}
ll binexp(ll a, ll b,ll md) {
    if (b == 0)
        return 1;
    ll res = binexp(a, b / 2,md);
    if (b % 2)
        return (((res %md) * res%md)%md * a)%md;
    else
        return (res * res)%md;
}
vector<ll> f(1000001);
int main() {
    ios
    ll n; in>>n; vi v(n); scnln(v);
    mi mp; for(auto i:v){mp[i]++;}
    ll ans=0;
    for(auto i:mp){
        ll tmp=i.ss*(i.ss-1); tmp/=2; ans+=tmp;
    }
    ll oans=ans;
    rep(k,0,n){
        ans=oans;
        ll excl=v[k];
        ll minus=mp[excl];
        ll tmp=minus*(minus-1); tmp/=2; ans-=tmp;
        tmp=(minus-1)*(minus-2); tmp/=2;
        if(minus-1<0&&minus-2<0) tmp=0;
        ans+=tmp;
        ot<<ans<<el;

    }

}

Measured memory_bytes: 18944