#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 1000000007;
  while (b) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b /= 2;
  }
  return res;
}
long long invmod(long long a) { return power(a, 1000000007 - 2); }
int getone(int x) {
  int ans = 0;
  while (x) {
    if (x & 1) ans++;
    x >>= 1;
  }
  return ans;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, x, ans = 0;
  cin >> n;
  int arr[40] = {0};
  for (long long i = 0; i < n; i++) {
    cin >> x;
    ans += arr[getone(x)]++;
  }
  cout << ans << endl;
  return 0;
}
