#include <bits/stdc++.h>
using namespace std;
int m[10000000];
int func(int v) {
  int r = 1;
  while (v != 1) {
    if (v % 2 == 0) {
      v /= 2;
    } else {
      v--;
      r++;
    }
  }
  return r;
}
int main() {
  int n, a;
  long long r = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    m[func(a)]++;
  }
  for (int i = 0; i < 10000000; i++) {
    r += (long long)(((long long)m[i] * (long long)(m[i] - 1)) / 2);
  }
  cout << r;
  return 0;
}
