#include <bits/stdc++.h>
using namespace std;
vector<long long> occurences[100];
int findRecursion(int number) {
  if (number == 0) return 0;
  if (number % 2 == 0)
    return findRecursion(number / 2);
  else
    return findRecursion(number / 2) + 1;
}
int main() {
  int n;
  cin >> n;
  int number;
  int functionResult;
  for (int i = 1; i <= n; i++) {
    cin >> number;
    functionResult = findRecursion(number);
    occurences[functionResult].push_back(i);
  }
  long long count = 0;
  long long apf;
  for (int i = 0; i < 100; i++) {
    apf = occurences[i].size();
    if (occurences[i].size() > 1) count += ((apf - 1) * apf) / 2;
  }
  cout << count << endl;
  return 0;
}
