int Solution::hammingDistance(const vector &A) {

int ans = 0;

int mod = 1000000007;

for(int i = 0; i<32; i++){

int ones = 0;

int zeroes = 0;

int ix = 1;

for(int j = 0; j<A.size(); j++){

if(A[j]&(ix<<i))

ones++;

else

zeroes++;

}

if(ones==0 || zeroes==0){

continue;

}

long long m = ((ones%mod)*(zeroes%mod))%mod;
m = ((m%mod)*(2%mod))%mod;

ans =((ans%mod)+(m%mod))%mod;

}

return ans;

}