#include <bits/stdc++.h>
using namespace std;
int bi(int x) {
  int ans = 0;
  while (x > 0) {
    ans += x % 2;
    x /= 2;
  }
  return ans;
}
int n;
map<int, long long> m;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    m[bi(x)]++;
  }
  long long ans = 0;
  for (auto i : m) {
    ans += ((i.second - 1) * i.second) / 2;
  }
  cout << ans;
  return 0;
}
