#include <bits/stdc++.h>
using namespace std;
int f[100000], n;
inline int F(int x) { return x == 0 ? 0 : F(x / 2) + x % 2; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    f[i] = F(a);
  }
  sort(f, f + n);
  int i = 0;
  long long res = 0;
  for (int j = 0; j < n; ++j)
    if (f[j] != f[i]) {
      res += (long long)(j - i) * (j - i - 1) / 2;
      i = j;
    }
  res += (long long)(n - i) * (n - i - 1) / 2;
  printf("%I64d\n", res);
  return 0;
}
