<?php
$n = int();
$a = ints();
$sum = 0;
for($i = 0; $i < 60; $i++){
  $c = 0;
  foreach($a as $b){
    $c += ($b >> $i) & 1; 
  }
  $sum += $c * ($n-$c) * (1<<$i);
  $sum %= 10**9+7;
}
echo $sum;

function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}