#include <bits/stdc++.h>
using namespace std;
long long int arr_res[1100];
int main() {
  int n;
  cin >> n;
  int* a = new int[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int temp = a[i];
    int res = 0;
    while (temp != 0) {
      int j = 1;
      for (int k = 1; k < 32; k++) {
        if (j <= temp && j * 2 > temp) {
          res += 1;
          temp -= j;
          break;
        }
        j *= 2;
      }
    }
    arr_res[res]++;
  }
  long long int res = 0;
  for (int i = 0; i < 1100; i++)
    if (arr_res[i] > 1) res += (arr_res[i] * (arr_res[i] - 1)) / 2;
  cout << res;
  return 0;
}
