#include <bits/stdc++.h>
using namespace std;
long long int N, tut[120000], cift, top, say, ar[120000], enes[120000], emre;
int main() {
  cin >> N;
  for (long long int i = 1; i <= N; i++) cin >> ar[i];
  for (long long int i = 1; i <= N; i++) {
    long long int k = 1;
    while (ar[i] != 1 && ar[i]) {
      if (ar[i] % 2) k++;
      ar[i] /= 2;
    }
    enes[k]++;
  }
  for (long long int i = 1; i <= 50; i++) {
    emre += enes[i] * (enes[i] - 1) / 2;
  }
  cout << emre << endl;
  return 0;
}
