传送门:http://codeforces.com/problemset/problem/272/B
#include<iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int r[35];
int main()
{
int N,a,p;
long long s=0;
scanf("%d",&N);
for(int i=0; i<N; i++)
{
p=0;
scanf("%d",&a);
while(a)p+=(a&1),a>>=1;
s+=r[p];
r[p]++;
}
printf("%I64d\n",s);
return 0;
}