#include <bits/stdc++.h>
const int INF = 100000000;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std;
int n;
long long b[100007];
long long f(int x) {
  long long res = 0;
  if (!x) return 0;
  if (x % 2 == 0) {
    res += f(x / 2);
  } else {
    res += f(x / 2) + 1;
  }
  return res;
}
long long ma = -1;
int main() {
  cin >> n;
  for (int i = 0; i < (n); i++) {
    int a;
    cin >> a;
    b[f(a)]++;
    ma = max(ma, f(a));
  }
  long long ans = 0;
  for (int i = 0; i < (ma + 1); i++)
    ans += (long long)((b[i] * (b[i] - 1)) / 2);
  cout << ans << endl;
  return 0;
}
