#include <bits/stdc++.h>
using namespace std;
long long int mem[1000];
int k;
map<long long int, long long int> first;
long long int f(long long int x) {
  if (first.find(x) != first.end()) return first[x];
  if (x % 2 == 0)
    return f(x / 2);
  else
    return f(x / 2) + 1;
}
int main() {
  first[0] = 0;
  first[1] = 1;
  map<long long int, long long int> q;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    long long int fx = f(x);
    q[fx]++;
  }
  long long int ans = 0;
  map<long long int, long long int>::iterator it;
  for (it = q.begin(); it != q.end(); it++) {
    ans += ((it->second) * (it->second - 1)) / 2;
  }
  cout << ans << endl;
  return 0;
}
