<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  $a = explode(" ", trim(fgets(STDIN)));

  $mod = 1000000007;
  $ans = 0;
  for($i=0; $i<=60; $i++){
    $zero = 0;
    $one = 0;
    $bit = pow(2, $i);
    for($j=0; $j<count($a); $j++){
      $xor = $a[$j] & $bit;
      //echo $a[$j]." ".$bit." ".$xor.PHP_EOL;
      if($xor == 0){
        $zero++;
      }else{
        $one++;
      }
    }
    //echo $zero." ".$one.PHP_EOL;
    $bit = $bit%$mod;
    $bit = $bit*$zero%$mod;
    $bit = $bit*$one%$mod;
    $ans = $ans+$bit%$mod;
  }
  
  echo $ans%$mod;