#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> c(n);
  for (int i = 0; i < n; i++) {
    long long k;
    cin >> k;
    c[i] = __builtin_popcount(k);
  }
  if (n == 1)
    cout << "0\n";
  else {
    sort(c.begin(), c.end());
    long long same = 1, res = 0;
    for (int i = 1; i < n; i++) {
      if (c[i] != c[i - 1]) {
        res += (same * (same - 1)) / 2;
        same = 1;
      } else
        same++;
    }
    res += (same * (same - 1)) / 2;
    cout << res << "\n";
  }
  return 0;
}
