#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[31] = {}, n, t(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, c(0);
    cin >> x;
    for (; x; x /= 2)
      if (x % 2 == 1) c++;
    a[c]++;
  }
  for (int i = 0; i < 31; i++)
    if (a[i]) t += a[i] * (a[i] - 1) / 2;
  cout << t << endl;
  return 0;
}
