#include <bits/stdc++.h>
using namespace std;
int n, ans[100000 + 10];
long long f(long long k) { return (k * (k - 1)) / 2; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int t;
    scanf("%d", &t);
    bitset<64> x = bitset<64>(t);
    ans[x.count()]++;
  }
  long long res = 0;
  for (int i = 0; i < 100000 + 10; ++i) res += f((long long)ans[i]);
  printf("%I64d\n", res);
  return 0;
}
