#include <bits/stdc++.h>
using namespace std;
int n, a[100000], f[100000];
long long tot[50];
int cal(int x) {
  int ret = 0;
  if (x) {
    if (x & 1)
      ret = cal(x / 2) + 1;
    else
      ret = cal(x / 2);
  }
  return ret;
}
int main() {
  int i, j, x;
  long long ans = 0;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (i = 0; i < n; ++i) f[i] = cal(a[i]);
  for (i = 0; i < n; ++i) tot[f[i]]++;
  for (i = 0; i < 50; ++i) ans = ans + tot[i] * (tot[i] - 1) / 2;
  printf("%I64d\n", ans);
  return 0;
}
