#include <bits/stdc++.h>
using namespace std;
int n;
int f[100005];
long long cnt[105];
long long ans;
int calc(int x) {
  if (x > 100000) {
    if (x % 2 == 0)
      return calc(x / 2);
    else
      return calc(x / 2) + 1;
  } else if (!f[x]) {
    if (x % 2 == 0)
      return f[x] = calc(x / 2);
    else
      return f[x] = calc(x / 2) + 1;
  } else
    return f[x];
}
int main() {
  scanf("%d", &n);
  f[1] = f[2] = 1;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    cnt[calc(a)]++;
  }
  for (int i = 1; i <= 100; i++)
    if (cnt[i] > 1) ans += cnt[i] * (cnt[i] - 1) / 2;
  printf("%I64d\n", ans);
  return 0;
}
