Dima got into number sequences. Now he's got sequence a1, a2, ..., an, consisting of n positive integers. Also, Dima has got a function f(x), which can be defined with the following recurrence:

  * f(0) = 0; 
  * f(2·x) = f(x); 
  * f(2·x + 1) = f(x) + 1. 



Dima wonders, how many pairs of indexes (i, j) (1 ≤ i < j ≤ n) are there, such that f(ai) = f(aj). Help him, count the number of such pairs. 

Input

The first line contains integer n (1 ≤ n ≤ 105). The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).

The numbers in the lines are separated by single spaces.

Output

In a single line print the answer to the problem.

Please, don't use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples

Input

3
1 2 4


Output

3


Input

3
5 3 1


Output

1

Note

In the first sample any pair (i, j) will do, so the answer is 3.

In the second sample only pair (1, 2) will do.
#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0)
    return b;
  else
    return gcd(b, b % a);
}
long long cnk(long long n, long long k, long long mod) {
  if (k > n) return 0;
  double result = 1;
  long long lal = 0;
  for (long long lol = n; lol > n - k; lol--) {
    result *= lol;
    result /= (n - lol + 1);
  }
  return (long long)result;
}
vector<long long> graph[100000];
vector<long long> vec;
vector<long long> vecis;
vector<pair<pair<int, int>, int> > vec3;
long long log4(long long val) {
  long long lol = 1;
  long long ii = 0;
  if (val == 1) {
    return 1;
  }
  while (lol < val) {
    ii++;
    lol *= 4;
  }
  return ii;
}
bool comp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return a.first.first > b.first.first;
}
string tostr(long long a) {
  ostringstream out;
  out << a;
  return out.str();
}
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    return power(a, b / 2) * power(a, b / 2);
  } else
    return a * power(a, b - 1);
}
long long tobig(string str) {
  long long res = 0;
  for (long long lol = 0; lol < str.size(); lol++) {
    res += (str[lol] - 48) * power(10, str.size() - 1 - lol);
  }
  return res;
}
int t[1000000][26];
int h;
void update(int v, int tl, int tr, int newval, int pos, int sym) {
  if (tl == tr) {
    t[v][sym] = newval;
    return;
  } else {
    int tm = (tl + tr) >> 1;
    if (pos <= tm) {
      update(v * 2, tl, tm, newval, pos, sym);
    } else {
      update(v * 2 + 1, tm + 1, tr, newval, pos, sym);
    }
  }
  t[v][sym] = t[v * 2][sym] + t[v * 2 + 1][sym];
}
int sum(long long v, int tl, int tr, int l, int r, int sym) {
  cout << v << "\n";
  if (l > r) return 0;
  if (l == tl && r == tr) return t[v][sym];
  int tm = (tl + tr) / 2;
  return sum(v * 2, tl, tm, l, min(r, tm), sym) +
         sum(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, sym);
}
long long su[100];
vector<bool> prime(200005, true);
vector<int> razn(100005);
long long cel(long long a, long long b) {
  long long res = a / b;
  if (a % b != 0) res++;
  return res;
}
long long mas[10000];
long long mas1[50], mas2[50];
long long a, b, c, d;
bool check(long long m) {
  long long res = 0;
  for (int lol = 0; lol < a; lol++) {
    if (vec[lol] > m) return true;
    res += m - vec[lol];
  }
  return res < m;
}
vector<long long> pauk(100001, 0);
long long kolvo[1000];
int main() {
  long long n, k, r1, r2;
  cin >> n;
  for (int lol = 0; lol < n; lol++) {
    cin >> k;
    long long res = 0;
    while (k != 0) {
      res += k % 2;
      k /= 2;
    }
    kolvo[res]++;
  }
  long long res = 0;
  for (int lol = 0; lol < 1000; lol++) {
    res += kolvo[lol] * (kolvo[lol] - 1) / 2;
  }
  cout << res;
  return 0;
}
