#include <bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
int solve(int x) {
  if (x == 0) return 0;
  if (x & 1)
    return solve(x / 2) + 1;
  else
    return solve(x / 2);
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  map<ll, ll> cnt;
  for (int i = 0; i < n; ++i) {
    ll x;
    cin >> x;
    cnt[solve(x)]++;
  }
  ll ans = 0;
  for (auto itr : cnt) ans = ans + (itr.second * (itr.second - 1)) / 2;
  cout << ans;
  return 0;
}
