#include <bits/stdc++.h>
using namespace std;
long long memo[10000000];
map<long long, long long> freq;
long long solve(long long n) {
  if (n < 10000000 && memo[n] != -1) return memo[n];
  return solve(n / 2) + n % 2;
}
int main() {
  ios::sync_with_stdio(false);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  memset(memo, -1, sizeof memo);
  memo[0] = 0;
  long long n;
  long long temp;
  cin >> n;
  while (n--) cin >> temp, freq[solve(temp)]++;
  long long sum = 0;
  for (auto it = freq.begin(); it != freq.end(); it++)
    sum += it->second * (it->second - 1) / 2;
  cout << sum << endl;
  return 0;
}
