#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000000;
int ff[maxn];
int f(int x) {
  if (x < maxn)
    return ff[x];
  else if (x % 2 == 0)
    return f(x / 2);
  else
    return 1 + f(x / 2);
}
int main() {
  int n, b, a[100000];
  cin >> n;
  ff[0] = 0;
  for (int i = 1; i < maxn; i++)
    if (i % 2 == 0)
      ff[i] = ff[i / 2];
    else
      ff[i] = ff[i / 2] + 1;
  long long res[200];
  for (int i = 0; i < n; i++) {
    cin >> b;
    a[i] = f(b);
    res[a[i]]++;
  }
  long long sum = 0;
  for (int i = 0; i < 200; i++) {
    if (res[i] > 0) sum += res[i] * (res[i] - 1) / 2;
  }
  cout << sum;
  return 0;
};
