#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

const ll INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ld EPS = 1e-9;
ll dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
ll dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

//0~nの範囲操作
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//1~nの範囲操作
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
//n~0を後ろから範囲操作
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
//出力後改行を
#define fin(ans) cout << (ans) << endl;
//出力後空白を
#define blank(ans) cout << (ans) << " ";
//２つの値をセットに\
sort -> p -> q
#define mp(p, q) make_pair(p, q)
//３つ以上の値をセットに(3より多いときはカッコ内を増やす)\
sort -> p -> q -> r
#define mt(p, q, r) make_tuple(p, q, r)
//配列全操作
#define all(a) a.begin(), a.end()
#define pb(n) push_back(n)

//配列の合計
template <typename T>
T Sum(vector<T> n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (accumulate(n.begin() + a, n.end(), 0));
  }
  else
  {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}
//少数時
template <>
ld Sum(vector<ld> n, ll a, ll b)
{
  if (b == 0)
  {
    return (accumulate(n.begin() + a, n.end(), 0.));
  }
  else
  {
    return (accumulate(n.begin() + a, n.begin() + b, 0.));
  }
}

//配列を昇順ソート
template <typename T>
void Sort(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b));
  }
}

//配列を降順ソート
template <typename T>
void Down(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end(), greater<ll>()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b, greater<ll>()));
  }
}

//配列を反転
template <typename T>
void Reve(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (reverse(n.begin() + a, n.end()));
  }
  else
  {
    return (reverse(n.begin() + a, n.begin() + b));
  }
}

//配列nをmにコピー
template <typename T, typename U>
void Copy(T &n, U &m, ll a = 0, ll b = 0)
{
  copy(all(n), m.begin());
}

//配列入力
template <typename T>
void V(T &n)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i];
  }
}

//２列配列入力
template <typename T, typename U>
void V2(T &n, U &m)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i];
  }
}

//３列配列入力
template <typename T, typename U, typename W>
void V3(T &n, U &m, W &p)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i] >> p[i];
  }
}

//２重配列入力
template <typename T>
void VV(T &n, ll size)
{
  for (ll i = 0; i < n.size(); i++)
  {
    for (ll j = 0; j < size; j++)
    {
      cin >> n[i][j];
    }
  }
}

//９０度回転
template <typename T>
void Rool(T &n, T &m, ll height, ll width)
{
  for (ll i = 0; i < width; i++)
  {
    for (ll j = 0; j < height; j++)
    {
      m[i][j] = n[height - j - 1][i];
    }
  }
}

//Yes, Noと表示後終了
void fYn(bool a)
{
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  exit(0);
}

//四捨五入
ll C45(ld n)
{
  return round(n);
}

//切り上げ (a / b)時
ll Up(ll a, ll b)
{
  return ((a + b - 1) / b);
}

//素数
bool IsPrime(ll num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  ld sqrtNum = sqrt(num);
  for (ll i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}

//桁数
ll GetDigit(ll num)
{
  return log10(num) + 1;
}

//各桁の和
ll KSum(ll n)
{
  ll sum = 0;
  if (n < 0)
    return 0;
  while (n > 0)
  {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

//約数全列挙
vector<ll> enum_div(ll n)
{
  vector<ll> ret;
  for (ll i = 1; i * i <= n; ++i)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
      {
        ret.push_back(n / i);
      }
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

//最大公約数
ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}

//複数個の最大公約数
ll ngcd(vector<ll> a)
{
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size() && res != 1; i++)
  {
    res = gcd(a[i], res);
  }
  return res;
}

//最小公倍数
ll lcm(ll a, ll b)
{
  return a * b / gcd(a, b);
}

//複数個の最小公倍数
ll nlcm(vector<ll> numbers)
{
  ll res;
  res = numbers[0];
  for (ll i = 1; i < numbers.size(); i++)
  {
    res = lcm(res, numbers[i]);
  }
  return res;
}

//累乗(xのn乗%mod)
ll modpow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

//逆数(aの逆数)
ll modinv(ll a, ll mod)
{
  ll b = mod, u = 1, v = 0;
  while (b)
  {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= mod;
  if (u < 0)
    u += mod;
  return u;
}

// a^x ≡ b (mod. m) となる最小の正の整数 x を求める
ll modlog(ll a, ll b, ll m)
{
  a %= m, b %= m;
  // calc sqrt{M}
  ll lo = -1, hi = m;
  while (hi - lo > 1)
  {
    ll mid = (lo + hi) / 2;
    if (mid * mid >= m)
      hi = mid;
    else
      lo = mid;
  }
  ll sqrtM = hi;
  // {a^0, a^1, a^2, ..., a^sqrt(m)}
  map<ll, ll> apow;
  ll amari = 1;
  for (ll r = 0; r < sqrtM; ++r)
  {
    if (!apow.count(amari))
      apow[amari] = r;
    (amari *= a) %= m;
  }
  // check each A^p
  ll A = modpow(modinv(a, m), sqrtM, m);
  amari = b;
  for (ll q = 0; q < sqrtM; ++q)
  {
    if (apow.count(amari))
    {
      ll res = q * sqrtM + apow[amari];
      if (res > 0)
        return res;
    }
    (amari *= A) %= m;
  }
  // no solutions
  return -1;
}

//階乗
ll factorial(ll n)
{
  if (n > 0)
    return n * factorial(n - 1);
  else
    return 1;
}

//順列 nPr
ll perm(ll a, ll b)
{
  return (factorial(a) / factorial(a - b));
}

//組み合わせ　nCr
ll comb(ll a, ll b)
{
  return (factorial(a) / (factorial(a - b) * factorial(b)));
}

//n ~ mの和
ll sigma(ll n, ll m)
{
  return ((n + m) * (m - n + 1) * 0.5);
}

//期待値
ld hope(ld a)
{
  return (sigma(1, a) / a);
}

//大文字->小文字(+32)
//少数はなるべく整数に

/*
[+][*] -> 毎回 ans %= mod
[-] -> if(ans < 0) ans += mod -> ans %= mod
[/] -> modinv(ans, mod) % mod //互いに素の時のみ
*/

void Main()
{
  ll n; cin >> n;
  vll a(n); V(a);
  vll seed;
  map<ll, ll> ans;
  rep(i, n)
  {
    if(ans.count(a[i])) ans[a[i]]++;
    else
    {
      ans[a[i]] = 1;
      seed.pb(a[i]);
    }
  }
  ll An = 0;
  rep(i, seed.size())
  {
    An += sigma(1, ans[seed[i]] - 1);
  }
  rep(i, n)
  {
    ll A = An;
    A -= sigma(1, ans[a[i]] - 1);
    A += sigma(1, ans[a[i]] - 2);
    fin(A)
  }
  return;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 12020