#include <bits/stdc++.h>
using namespace std;
vector<long long> cnt;
int f(long long x) {
  if (x == 0) return 0;
  int r = 1;
  while (x != 1) {
    r += x % 2;
    x /= 2;
  }
  return r;
}
int main() {
  int n;
  cin >> n;
  cnt.assign(1000000, 0);
  for (int i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    cnt[f(tmp)]++;
  }
  long long s = 0;
  for (int i = 0; i < 1000000; i++) s += cnt[i] * (cnt[i] - 1);
  cout << s / 2;
  return 0;
}
