#include <bits/stdc++.h>
using namespace std;
long long m, n;
char a[10];
int b[10];
int ha[100001];
int main() {
  while (scanf("%I64d", &m) != EOF) {
    memset(ha, 0, sizeof(ha));
    long long c = 0;
    for (int i = 0; i < m; i++) {
      scanf("%I64d", &n);
      int sum = 0;
      while (1) {
        if (n == 0)
          break;
        else if (n == 1) {
          sum++;
          break;
        }
        if (n % 2 == 0) {
          n = n / 2;
        } else {
          sum++;
          n = n / 2;
        }
      }
      if (ha[sum] != 0) {
        c += ha[sum];
        ha[sum]++;
      } else {
        ha[sum]++;
      }
    }
    printf("%I64d\n", c);
  }
  return 0;
}
