#include <bits/stdc++.h>
using namespace std;
long long ar[100005];
map<long long, long long> mb;
long long rec(long long indx) {
  if (indx == 0) return 0;
  if (indx % 2 == 0)
    return rec(indx / 2);
  else
    return (1 + rec(indx / 2));
}
int main() {
  long long n, i, j, k, l = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> j;
    k = rec(j);
    if (!mb[k]) ar[l++] = k;
    mb[k]++;
  }
  long long cnt = 0;
  for (i = 0; i < l; i++) {
    k = mb[ar[i]] - 1;
    cnt += (k * (k + 1)) / 2;
  }
  cout << cnt << endl;
}
