<?php
$ans = 0;
$memo = [];
fscanf(STDIN, '%d', $cnt);
$nums = array_map('intval', explode(' ', trim(fgets(STDIN))));
for ($i=0; $i < 60; $i++) { 
    $tmp = 0;
    foreach ($nums as $num) {
        $tmp += ($num>>$i) & 1;
    }
    $ans += $tmp * ($cnt-$tmp) * (1<<$i);
}
echo ($ans % (10**9+7))."\n";
