#include <bits/stdc++.h>
using namespace std;
long long B[33] = {};
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    int k = 0;
    for (int i = 0; x >> i; i++)
      if ((x >> i) & 1) k++;
    B[k]++;
  }
  long long res = 0;
  for (int i = 0; i < 33; i++) res += B[i] * (B[i] - 1) / 2;
  printf("%I64d\n", res);
}
