#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 6;
const int inf = (int)1e9 * 2;
const int mod = (int)1e9 + 7;
int n;
long long a[maxn], cnt;
inline int fun(int x) {
  if (x == 0) return 0;
  if (x % 2 == 0) return fun(x / 2);
  return fun(x / 2) + 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[fun(x)]++;
  }
  for (int i = 0; i < 100000; i++) {
    cnt += a[i] * 1ll * (a[i] - 1) / 2;
  }
  printf("%lld\n", cnt);
  return 0;
}
