#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T countBit(T n) {
  T ans = 0;
  while (n) {
    n = n & (n - 1);
    ans++;
  }
  return ans;
}
long long dp[50];
int main() {
  int n;
  cin >> n;
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    dp[countBit(a)]++;
  }
  long long ans = 0;
  for (int i = 0; i < sizeof(dp) / sizeof(long long); i++) {
    if (dp[i]) ans += dp[i] * (dp[i] - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}
