#include <bits/stdc++.h>
using namespace std;
long long int n, m, i, j, k, l, a[1000009], b[1000009], p[1000009], ans, cn, t,
    x, y, z, e, o;
char c[1000009], d[1000009], ch;
void pa() {
  memset(p, 0, sizeof(p));
  for (i = 2; i < 1000000; i++) {
    p[i] = p[i - 1] + i - 1;
  }
}
int main() {
  pa();
  while (scanf("%I64d", &n) != EOF) {
    ans = 0;
    memset(b, 0, sizeof(b));
    for (i = 0; i < n; i++) {
      scanf("%I64d", &x);
      cn = 0;
      while (x != 0) {
        if (x % 2 == 0) {
          x /= 2;
        } else {
          cn++;
          x = (x - 1) / 2;
        }
      }
      b[cn]++;
    }
    for (i = 0; i < 100; i++) {
      ans = ans + p[b[i]];
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
