#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
using namespace std;
map<long long, long long> mpp;
int32_t main() {
  long long n;
  cin >> n;
  long long i, a[n + 5], p[n + 5];
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) {
    long long x = a[i];
    long long c = 0;
    while (x) {
      if (x % 2) c++;
      x /= 2;
    }
    p[i] = c;
  }
  long long sum = 0;
  for (i = 1; i <= n; i++) {
    mpp[p[i]]++;
    sum = sum + (mpp[p[i]] - 1);
  }
  cout << sum;
  return 0;
}
