#include <bits/stdc++.h>
using namespace std;
vector<int> vec;
map<int, int> mp, mp1;
queue<int> q;
int a[100002], d[10000002];
string s;
int rec(int x) {
  if (x == 0) return 0;
  if (x % 2 != 0)
    return rec(x / 2) + 1;
  else
    return rec(x / 2);
}
int main() {
  int i, j, k, l, m, n, x, y;
  long long sum = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] = rec(a[i]);
    d[a[i]]++;
  }
  for (i = 1; i <= n; i++) {
    sum += max(0, d[a[i]] - 1);
    d[a[i]]--;
  }
  cout << sum;
  return 0;
}
