#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int n, x, t;
long long ans, s[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    t = 0;
    while (x) {
      t += x % 2;
      x /= 2;
    }
    ++s[t];
  }
  for (int i = 1; i <= N; ++i) ans += s[i] * (s[i] - 1) / 2;
  cout << ans;
}
