#include <bits/stdc++.h>
using namespace std;
int n, m, k, a, i, j, z;
long long res, d[40];
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> j;
    while (j != 1) {
      k = k + j % 2;
      j = j / 2;
    }
    d[k]++;
    k = 0;
  }
  for (i = 0; i <= 32; i++) {
    res = res + (d[i] * (d[i] - 1)) / 2;
  }
  cout << res;
}
