#include <bits/stdc++.h>
using namespace std;
long long cnt[36];
int main() {
  int n, i, j, a;
  cin >> n;
  for (i = 0; i <= n - 1; i++) {
    scanf("%d", &a);
    int c = 0;
    if (a & 1) c++;
    while (a) {
      if ((a >> 1) & 1) c++;
      a = (a >> 1);
    }
    cnt[c]++;
  }
  long long s = 0;
  for (i = 0; i <= 36; i++) s += cnt[i] * (cnt[i] - 1) / 2;
  cout << s << endl;
  return 0;
}
