#include <bits/stdc++.h>
using namespace std;
int n, x;
long long res, m[100];
int f(int n) {
  if (n == 0) return 0;
  return f(n / 2) + n % 2;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  while (n--) {
    cin >> x;
    m[f(x)]++;
  }
  for (int i = 0; i < 100; ++i) {
    res += m[i] * (m[i] - 1) / 2;
  }
  cout << res;
}
