#include <bits/stdc++.h>
using namespace std;
long long calc(long long n) {
  if (n == 0) return 0;
  if (n % 2 == 0) return calc(n / 2);
  if (n % 2 == 1) return calc(n / 2) + 1;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> v;
  map<long long, long long> m;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    v.push_back(tmp);
    m[calc(tmp)]++;
  }
  long long res = 0;
  map<long long, long long>::iterator it = m.begin();
  for (int i = 0; i < m.size(); i++, it++) {
    res += (it->second) * (it->second - 1) / 2;
  }
  cout << res << endl;
  return 0;
}
