#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool IsPrime(long long x) {
  bool isPrime = true;
  for (long long a = 2; a * a <= x; a++) {
    if (x % a == 0) return false;
  }
  return true;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, s = 0, sum = 0, x;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    x = a[i];
    s = 0;
    while (x != 0) {
      if (x % 2 == 1) {
        s++;
      }
      x /= 2;
    }
    m[s]++;
  }
  for (auto i = m.begin(); i != m.end(); i++)
    sum += i->second * (i->second - 1) / 2;
  cout << sum;
}
