#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long ans[maxn], a[maxn], vis[maxn];
int main() {
  long long x, n, all, m;
  scanf("%I64d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &x);
    all = 0;
    while (x > 0) {
      m = x & 1;
      all += m;
      x = x >> 1;
    }
    a[i] = all;
    ans[all]++;
  }
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[a[i]] == 0) {
      sum += (ans[a[i]] - 1) * ans[a[i]] / 2;
      vis[a[i]] = 1;
    }
  }
  printf("%I64d", sum);
}
