#include <bits/stdc++.h>
using namespace std;
int cnt[500010];
map<int, int> mp;
int get(int x) {
  if (mp.count(x)) return mp[x];
  return mp[x] = x % 2 + get(x / 2);
}
int main() {
  mp[0] = 0;
  int n, mx = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    x = get(x);
    cnt[x]++;
    mx = max(mx, x);
  }
  long long int amid = 0;
  for (int i = 1; i <= mx; i++) {
    long long int c = cnt[i];
    amid += (c * (c - 1)) / 2;
  }
  cout << amid << '\n';
}
