#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
int f(int a) {
  if (a == 0)
    return 0;
  else if (a % 2 == 0)
    return f(a / 2);
  else
    return f(a / 2) + 1;
}
int N;
ll ans = 0;
int main() {
  cin >> N;
  vector<int> a(N);
  map<int, ll> mp;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    mp[f(a[i])]++;
  }
  for (auto &p : mp) {
    ans += p.second * (p.second - 1) / 2;
  }
  cout << ans << endl;
}
