#include <bits/stdc++.h>
using namespace std;
map<long long, int> st;
long long f(int a) {
  if (a == 0) return 0;
  if (a % 2 == 0)
    return f(a / 2);
  else
    return f((a / 2)) + 1;
}
int main() {
  int n, a;
  long long tmp, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    tmp = f(a);
    if (st.find(tmp) == st.end()) {
      st[tmp] = 1;
    } else {
      cnt += st[tmp];
      st[tmp]++;
    }
  }
  cout << cnt << endl;
  return 0;
}
