#include <bits/stdc++.h>
using namespace std;
int a[100002];
int b[100002];
int n;
map<int, int> p;
int f(int x) {
  if (x == 0) return 0;
  if (x & 1)
    return f(x >> 1) + 1;
  else
    return f(x >> 1);
}
int main() {
  long long ans;
  int i, x;
  p.clear();
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  sort(a + 1, a + 1 + n);
  ans ^= ans;
  for (i = 1; i <= n; i++) {
    x = f(b[i]);
    if (p[x] == 0)
      p[x] = 1;
    else {
      ans = ans + p[x];
      p[x] = p[x] + 1;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
