import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val MOD = 1e9.toInt + 7

  val N = in.next().toInt
  val A = new Array[Long](N+1)
  for (i <- 1 to N)
    A(i) = in.next().toLong

  //
  val dp = new Array[Long](65)

  // 準備 桁ごとの1の数を用意
  for (e <- A.drop(1)) {
    var now = e
    var ind = 0
    while (now > 0) {
      if (now % 2 == 1) {
        dp(ind) += 1
      }
      now /= 2
      ind += 1
    }
  }

  def comb2(n: Long): Long = {
    val res =
      if (n % 2 == 0) {
        (n / 2) * (n-1)
      }
      else {
        n * ((n-1) / 2)
      }

    res % MOD
  }

  var ans = 0L
  var base = 1L
  for (i <- 0 until 65) {
    val cnt = dp(i)
    if (i > 0) {
      base *= 2
      base %= MOD
    }
    

    val one = cnt
    val zero = N - cnt
    val hoge = (one * zero) % MOD
    ans += base * hoge
    ans %= MOD
  }

  println(ans)
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.deep))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
