#include <bits/stdc++.h>
using namespace std;
const char* fi = "loco2.inp";
const char* fo = "loco2.out";
const int maxn = 1e5 + 2;
int n, a[maxn], dem[maxn];
void nhap() {
  cin >> n;
  for (int i = (1); i <= (n); i++) cin >> a[i];
}
int cal(int x) {
  return x == 0 ? 0 : (x % 2 == 0 ? cal(x / 2) : cal(x / 2) + 1);
}
void xl() {
  nhap();
  for (int i = (1); i <= (n); i++) a[i] = cal(a[i]);
  long long res = 0;
  for (int i = (1); i <= (n); i++) res += dem[a[i]], dem[a[i]]++;
  cout << res;
}
int main() {
  ios::sync_with_stdio(false);
  xl();
}
