#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> val(100005, 0);
  unsigned long long ans = 0ULL;
  for (int(i) = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    int f = 0;
    while (a != 0) {
      if (a & 1) f++;
      a >>= 1;
    }
    val[f]++;
  }
  for (int(i) = 0; i < val.size(); i++) {
    ans += (1ULL * val[i] * (val[i] - 1)) / 2;
  }
  cout << ans << endl;
  return 0;
}
