#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  map<long long int, long long int> mpp;
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    mpp[__builtin_popcount(x)]++;
  }
  long long int ans = 0;
  for (auto p : mpp) {
    ans += (p.second) * (p.second - 1) / 2;
  }
  cout << ans;
}
