#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, f[1001] = {0}, ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int b = 0;
    cin >> a;
    while (a > 0) {
      if (a % 2 == 0)
        a = a / 2;
      else {
        b++;
        a = (a - 1) / 2;
      }
    }
    f[b]++;
  }
  for (int i = 0; i <= 1000; i++) {
    ans += f[i] * (f[i] - 1) / 2;
  }
  cout << ans;
}
