function Main(input) {
  input = input.split("\n");
  var N = input[0];
  var A = input[1];
  A = A.split(" ").map(Number);
  for(var i=0;i<N;i++){
    A[i] = A[i].toString(2);
    A[i] = ( '000000000000000000000000000000000000000000000000000000000000' + A[i] ).slice( -60 );
  }
  var sum = [];
  for(var j=1;j<=60;j++){
    var count = 0;
    for(var k=0;k<N;k++){
    var n = A[k];
    if(n.substr(-1*j,1) == 1){
    count++;
    }
      //console.log(j,k,n.substr(-1*j,1))
  }
        sum.push(count);
  }
  var ans = 0;
  for(var o=0;o<60;o++){
  ans += sum[o]*(N-sum[o])*Math.pow(2,o);
    if(ans>=1000000007){
    ans = ans%1000000007;
    }
  }
  //console.log(sum,A);
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
