#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
int main() {
  long long tc, cnt = 0;
  cin >> tc;
  while (tc--) {
    long long x;
    cin >> x;
    long long p = __builtin_popcount(x);
    mp[p]++;
    cnt += (mp[p] - 1);
  }
  cout << cnt << endl;
}
