#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long sz, ans, cnt[200];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.precision(30);
  cerr.precision(7);
  ;
  cin >> sz;
  for (int i = 1; i <= sz; i++) {
    long long in;
    cin >> in;
    cnt[__builtin_popcountll(in)]++;
  }
  for (long long i = 0LL; i <= 100LL; i++)
    ans += (cnt[i] * (cnt[i] - 1LL)) / 2LL;
  cout << ans;
  return 0;
}
