#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
long long check[100000 + 5], prim[100000 + 5];
long long a[100000 + 5];
map<long long, int> mp;
set<long long> scond;
int main() {
  long long i = 0, j = 0, k = 1, l = 0;
  long long n, m;
  long long y, x, s = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    k = a[i];
    s = 0;
    while (k) {
      if (k % 2)
        s++, k = (k - 1) / 2;
      else
        k /= 2;
    }
    a[i] = s;
    scond.insert(s);
    mp[s]++;
  }
  s = 0;
  set<long long>::iterator it = scond.begin();
  for (; it != scond.end(); it++) {
    k = *it;
    x = mp[k];
    x = x * (x - 1) / 2;
    s += x;
  }
  cout << s << endl;
  return 0;
}
