#include <bits/stdc++.h>
using namespace std;
int f(long long n) {
  int cnt = 0;
  while (n) {
    cnt += n % 2;
    n = n / 2;
  }
  return cnt;
}
int main() {
  long long n;
  cin >> n;
  map<long long, long long> mp;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    mp[f(x)]++;
  }
  long long sol = 0;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    sol += (it->second) * (it->second - 1) / 2;
  }
  cout << sol;
}
