#include <bits/stdc++.h>
long long a[1000006];
int main() {
  long long i, j, k, l, m, n;
  while (scanf("%I64d", &n) == 1) {
    for (i = 1; i <= n; i++) {
      scanf("%I64d", &m);
      l = 0;
      while (m) {
        if (m % 2) l++;
        m /= 2;
      }
      a[l]++;
    }
    k = 0;
    for (i = 0; i < 10000; i++) {
      m = a[i];
      l = (m * (m - 1));
      l /= 2;
      k += l;
    }
    printf("%I64d\n", k);
  }
  return 0;
}
