#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  long long a[n];
  map<long long, long long> m;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    sum = 0;
    cin >> a[i];
    while (a[i] > 0) {
      if (a[i] % 2) sum++;
      a[i] /= 2;
    }
    m[sum]++;
  }
  long long ans = 0;
  for (auto it : m) {
    ans += (it.second * (it.second - 1)) / 2;
  }
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
